Testing Blogging Page
did
is a library for matching human-quality input to a list of potential matches using the Levenshtein distance algorithm.
It is inspired by did.
Very Long Long Long Long Long Long Long Long Long Long Long
Based on LEVEN, the fastest JS implementation of the Levenshtein distance algorithm
~100% faster than did
Well tested with 100% coverage
Static type checking with TypeScript
More control on what kind of matches you want to return
Support matching object's
path
instead of justkey
Installation
npm install didyoumean2
const didYouMean = require('didyoumean2').default
// or if you are using TypeScript or ES module
import didYouMean from 'didyoumean2'
// you can also access to Enums via:
const {
default: didYouMean,
ReturnTypeEnums,
ThresholdTypeEnums,
} = require('didyoumean2')
// or
import didYouMean, { ReturnTypeEnums, ThresholdTypeEnums } from 'didyoumean2'
const a = async () => {
return <div {...span} />
}
export function* gen() {}
Usage
didYouMean(input, matchList[, options])
input {string}
: A string that you are not sure and want to match withmatchList
matchList {Object[]|string[]}
: A List for matching withinput
options {Object}
(optional): An options that allows you to modify the behavior@return {Array|null|Object|string}
: A list of or single matched result(s), return object ifmatch
is{Object[]}
Test
Before all:
npm install -g yarn
yarn install
Unit test and coverage:
yarn test
Linter:
yarn lint