0.1.2 • Published 9 years ago
highlight-fragment.js v0.1.2
highlight-fragment.js (written in ES6)
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