1.0.3 • Published 9 years ago

highlight-string-pattern v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

highlight-string-pattern

Highlight a pattern in a string.

Example

import highlight from 'highlight-string-pattern';

console.log(highlight('AAAbAAbAA', 'b'));
// ---b--b--

console.log(highlight(LOREM_IPSUM, 'te'));
/*
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ultrices, odio eget laoreet vehicula, leo purus rhoncus justo, aliquam tincidunt odio ante quis erat. Aliquam feugiat pharetra sodales. Maecenas vel tempus neque. Phasellus massa tortor, elementum quis arcu ac, lacinia semper libero. Sed at ipsum nec eros efficitur laoreet at non neque. Pellentesque tincidunt luctus massa vel dictum. Morbi arcu orci, placerat nec porta vel, consectetur quis quam. Fusce varius est in arcu sollicitudin vestibulum. Vestibulum ac ligula arcu. In hac habitasse platea dictumst. Donec congue ante pulvinar tortor placerat tempor. Pellentesque pulvinar mauris eu odio tempor mollis ac a.
----------------------------------te-----------------------te--------------------------------------------------------------------------------------------te-----------------------------------------------------------te-----------------------------------------------------------------------------------------------------------------------------------------------te---------------------------------------------------------------------------------------te----------------------------------------------------------------------------------------------------------------te---------------------------te--------------------------te------------te-----------------------------te-----------------
*/
1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago