matching.js

1.0.8 • Public • Published

matching.js

Node.js CI codecov npm version

Install

npm install matching.js -S

or

yarn add matching.js

Usage

import matching from 'matching.js'

matching('interface *highlight code* end', {
  startChar: '*',
  endChar: '*',
  cb: (str) => (<span className="hign-light">{str}</span>)
})

// output
['interface', <span className="hign-light">highlight code</span>, ' end']

Interface Type

type Matching<T = any> = (str: string, option: Option<T>) => T[]

interface Option<T> {
  /**
   * start chartacter
   */
  startChar: string
  /**
   * end chartacter
   */
  endChar: string
  /**
   * matching map
   */
  cb?: (str: string) => T
  /**
   * greedy mode
   */
  isGreedy?: boolean
}

Dev

npm start

Readme

Keywords

Package Sidebar

Install

npm i matching.js

Weekly Downloads

10

Version

1.0.8

License

ISC

Unpacked Size

18.7 kB

Total Files

12

Last publish

Collaborators

  • cacivy