New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

highlight-words-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highlight-words-parser

Parse a give string to highlight words

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Highlight Words Parser

Features

Parse a give string to highlight words.

Installation

yarn add highlight-words-parser

or

npm i highlight-words-parser --save

Usage

import { highlightWordsParser } from 'highlight-words-parser'

const highlightWords = highlightWordsParser('Error: this is a "test" message (from somewind)', {
  keywords: [{
    color: 'red',
    value: [
      'Error'
    ]
  }],
  scopes: [
    {
      color: 'green',
      value: ['"', '"']
    },
    {
      color: 'green',
      value: ['(', ')']
    }
  ]
})

console.log(highlightWords)

// Output:
//
// [ { color: 'red', value: 'Error' },
//   { value: ': this is a ' },
//   { color: 'green', value: '"test"' },
//   { value: ' message ' },
//   { color: 'green', value: '(from somewind)' } ]

You can use the result to render with React or other.

License

MIT

Keywords

highlight

FAQs

Package last updated on 16 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts