0.0.6 • Published 5 years ago

cursor-match v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

cursor-match

Finds a fragmented string within a text body.

const match = require('cursor-match')
const str = 'Hello world'
const text = '<span class="icon"></span>Hello \n<p>world</p>!'
match(str, text) // 'Hello \n<p>world'

options

  • ignoreHtml - decides whether to ignore html tags in the search (default: true)
  • threshold - decides how many non-matches will be accepted until a cursor is discarded (default: 10)
  • confidence - decides when the algorithm stops adding cursors and assumes a match has been found, by defining a confidence level about a given cursor's position in respect of the total string (default: 1, i.e. ignore)
match(str, text, { threshold: 20, confidence: 0.5 }) // will stop adding cursors when any of them reaches 50% of the length of the string to be found.
0.0.6

5 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago