highlight-fragment.js

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i highlight-fragment.js

Weekly Downloads

4

Version

0.1.2

License

MIT

Last publish

Collaborators

  • meandmax