Gathering detailed insights and metrics for didyoumean3
Gathering detailed insights and metrics for didyoumean3
Gathering detailed insights and metrics for didyoumean3
Gathering detailed insights and metrics for didyoumean3
npm install didyoumean3
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
6 Stars
39 Commits
20 Branches
1 Contributors
Updated on 27 Mar 2023
TypeScript (88.96%)
JavaScript (11.04%)
Cumulative downloads
Total Downloads
Last day
-39%
100
Compared to previous day
Last week
-22.9%
769
Compared to previous week
Last month
-10.1%
3,828
Compared to previous month
Last year
-5.7%
54,685
Compared to previous year
1npm i didyoumean3 2 3// or 4yarn add didyoumean3
1import { didyoumean3 } from 'didyoumean3' 2// or 3const { default: didyoumean3 } = require('didyoumean3'); 4 5let input = 'insargrm' 6let list = [ 7 'facebook', 'INSTAgram', ' in stagram', 'baidu', 'twitter', 'wechat', 'instagram', 'linkedin' 8] 9 10console.log(didyoumean3(input, list)); 11// will print: 12// { 13// winner: 'instagram', // 🔥 This is the best match, our winner! 14// matched: [ 15// { 16// score: 8, 17// target: 'facebook', 18// }, 19// { 20// score: 3, 21// target: 'instagram', 22// }, 23// { 24// score: 7, 25// target: 'linkedin', 26// }, 27// // ... 28// ], 29// }
didyoumea3
has some built-in string formatting configuration items:
ignore
: Ignore case when comparing, default false.
trim
: Use string.trim
format the string, default true.
trimAll
: Use regexp /\s+/g
formate the string, default false.
diacritics
: Use normalize
Api, e.g. 'café' -> 'café'.normalize(), default false
normalize
: Customize the formatting function by yourself.
🔥 If these parameters don't meet your requirements, you can customize the formatting function through
normalize
.
🔥 When using the custom normalize function, the above string formatting configurations will be ignored.
1didyoumean3(input, target, { normalize: (s: string) => s.trim() } );
result
: Customize the structure of the results you want to return
1// default result may be null or {winner: xx, matched: []} 2type Res = null | { matched: any[], winner: string } 3 4// you can custom your own result style!! 5const result = (res: Res) => { 6 if (!res) return 'nothing matched!' 7 else return res 8} 9 10didyoumean3(input, target, { result } );
filter
: You can filter the results you want, such as those with a score greater than 5
1let i2 = 'insargrm'; 2let l2 = ['facebook', 'instagram', 'linkedin']; 3expect( 4 didyoumean3(i2, l2, { filter: (score: number, item: any) => score >= 7 }) 5 ?.matched.length 6).toBe(2);
1didyoumean x 159,428 ops/sec ±1.63% (85 runs sampled) 2didyoumean2 x 227,343 ops/sec ±1.26% (90 runs sampled) 3didyoumean3 x 400,683 ops/sec ±0.59% (89 runs sampled) 4Fastest is didyoumean3
Both issure and pr are welcome!
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/25 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More