fuzzy-array-filter
Advanced tools
Comparing version 0.0.1-a to 0.0.1-b
15
index.js
var Fuse = require('fuse.js'); | ||
var fuzzySearch = function(value, options) { | ||
var fuzzyFilter = function(value, options = {}) { | ||
var defaultOptions = { | ||
threshold: 0.6, | ||
threshold: 0.4, | ||
location: 0, | ||
@@ -12,8 +12,8 @@ distance: 100, | ||
let fuse = null; | ||
let result = null; | ||
var fuse = null; | ||
var result = null; | ||
return (val, key, array) => { | ||
return function(val, key, array) { | ||
if (!fuse || !result) { | ||
fuse = new Fuse(array, options || defaultOptions) | ||
fuse = new Fuse(array, Object.assign(defaultOptions, options)) | ||
result = fuse.search(value); | ||
@@ -25,3 +25,2 @@ } | ||
module.exports.fuzzySearch = fuzzySearch; | ||
module.exports = fuzzyFilter; |
{ | ||
"name": "fuzzy-array-filter", | ||
"version": "0.0.1a", | ||
"version": "0.0.1b", | ||
"description": "A simple array fuzzy filtering", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14796
5
1
73