打赏

didyoumean 输入匹配

1、简介

JavaScript匹配引擎。

https://www.npmjs.com/package/didyoumean

2、示例

var input = 'insargrm'
var list = ['facebook', 'twitter', 'instagram', 'linkedin'];
console.log(didYouMean(input, list));
> 'instagram'
// The method matches 'insargrm' to 'instagram'.

input = 'google plus';
console.log(didYouMean(input, list));
> null
// The method was unable to find 'google plus' in the list of options.

 

posted @ 2020-02-15 19:48  孟繁贵  阅读(474)  评论(0编辑  收藏  举报
TOP