0.1.2 • Published 9 years ago

highlight-fragment.js v0.1.2

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

highlight-fragment.js (written in ES6)

license npm build Coverage Status code climate devDependencies js-standard-style

Install:

npm install highlight-fragment.js

Run tests

npm test

highlightFragment()

returns the sequence with highlighted fragment if the pattern matches, else just the sequence.

import highlightFragment from 'highlight-fragment.js';

// result: 'm<strong>e - an</strong>dmax'
highlightFragment('me - andmax', 'ean', '[- ]*', 'strong');

// result: '0<strong>163</strong> - 3094512'
highlightFragment('0163 - 3094512', '163', '[- ]*', 'strong')

Copyright

Copyright © 2015 Maximilian Heinz, contributors. Released under the MIT License