
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
FuzzyFind is a matching algorithm for filtering and ranking a list based on partial user input.
FuzzyFind is a matching algorithm for filtering and ranking a list based on partial user input.
array fuzzyfind ( string $query , array $collection [, object $options ])
accessor function: Function that transforms your items into strings.precision number: How precise you want your search to be, between 0 and 1.var fuzzyfind = require('fuzzyfind')
var collection = [
'migrations.py',
'django_migrations.py',
'django_admin_log.py',
'api_user.doc',
'user_group.doc',
'users.txt',
'accounts.txt'
]
console.log(fuzzyfind('djmi', collection))
[ 'django_migrations.py', 'django_admin_log.py' ]
If you want to pass in an array of anything other than a string you can also provide an accessor function as the third argument. This must return a string.
var fuzzyfind = require('fuzzyfind')
var collection = [
{ name: 'migrations.py', size: '12kb'},
{ name: 'django_migrations.py', size: '11kb'},
{ name: 'django_admin_log.py', size: '10kb'},
{ name: 'api_user.doc', size: '9kb'},
{ name: 'user_group.doc', size: '13kb'},
{ name: 'users.txt', size: '12kb'},
{ name: 'accounts.txt', size: '10kb'},
]
function accessorFn (obj) {
return obj.name
}
console.log(fuzzyfind('djmi', collection, { accessor: accessorFn }))
[ 'django_migrations.py', 'django_admin_log.py' ]
Precision can also be defined in your search, if you want to be more inclusive in your results. The lower your precision the more matches you get, with a precision of 1 you want to match the full word, while a precision of 0 would be matching any letter in your query.
The size of the match is taking into account, so having less precision would
just be adding more results to the end of your results.
To define precision:
var fuzzyfind = require('fuzzyfind')
var collection = [
'migrations.py',
'django_migrations.py',
'django_admin_log.py',
'api_user.doc',
'user_group.doc',
'users.txt',
'accounts.txt'
]
console.log(fuzzyfind('djmi', collection, { precision: 0.5 }))
[ 'django_migrations.py', 'django_admin_log.py', 'migrations.py' ]
The algorithm was influenced by a blog post about fuzzy finding.
FAQs
FuzzyFind is a matching algorithm for filtering and ranking a list based on partial user input.
We found that fuzzyfind demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.