npm.io
0.0.8 • Published 6 years ago

sem1083.fuzzy

Licence
ISC
Version
0.0.8
Deps
0
Size
2 kB
Vulns
0
Weekly
0

Sem1083.fuzzy

Sem1083.fuzzy is a node.js package used for approximate string matching.

Installation

Use the package manager npm to install this package.

npm install sem1083.fuzzy

Usage

compare -> Compare two strings. This will return a score between 0 and 1.

let x = require(`sem1083.fuzzy`);

x.compare('fuzy','fuzzy')
//=> 0.8571428571428571

filter -> Compare a string with an array of strings. Will return a sorted array with the first entry being the best and the last the worst.

let x = require(`sem1083.fuzzy`);

x.filter('fuzy',['fuzzy','fuzy'])
//=> [ [Object], [Object], get: [Function] ]
//=> First object: { string: 'fuzy', score: 1 }

x.filter('fuzy',['fuzzy','fuzy']).get(0,1) //.get is slice but fancy
//=> [ [Object], get: [Function] ]