Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

Find the closest match for a string from an array of matches, using string distance.

Notifications You must be signed in to change notification settings

ianstormtaylor/closest-match

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

closest-match

Find the closest match for a string from an array of matches, using string distance.

Installation

$ component install ianstormtaylor/closest-match

Example

var closest = require('closest-match');
var animals = ['dog', 'cat', 'bird'];

closest('dag', animals); // 'dog'

API

closest(string, matches)

Match the given string against an array of possible matches.

closest.threshold

Change the string distance threshold used to match. Default is 3.

closest.distance

Change the distancing method. Default is the timoxley/sift component.

License

MIT

About

Find the closest match for a string from an array of matches, using string distance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published