ec-highlighter-core

1.0.5 • Public • Published

Installation

npm i ec-highlighter-core

API

Split the text into arrays based on a search string needed for highlighting in the UI The module is exported as a function. This function search a text for a string and returns an array of objects. The object has the text key and the match key.

import getParts from 'ec-highlighter-core'

const textToSearch = 'Javascript is developer friendly'
const searchPhrase = 'IS'

console.log('OUTPUT:', getParts(textToSearch, searchPhrase))

/*
OUPUT: [
  {text:"Javascript ", match: false},
  {text:"is", match: true},
  {text:" developer friendly", match: false} 
] 
*/

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    9
    • latest

Version History

Package Sidebar

Install

npm i ec-highlighter-core

Weekly Downloads

9

Version

1.0.5

License

ISC

Unpacked Size

3.08 kB

Total Files

4

Last publish

Collaborators

  • nishanthshankar