Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fuzzyset.js

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuzzyset.js - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

25

lib/fuzzyset.js
(function() {
var FuzzySet = function(arr, useLevenshtein, gramSizeLower, gramSizeUpper) {
var fuzzyset = {};
var fuzzyset = {
version: '0.0.1'
};

@@ -86,5 +88,8 @@ // default options

// the main functions
fuzzyset.get = function(value, defaultValue) {
fuzzyset.get = function(value, defaultValue, minMatchScore) {
// check for value in set, returning defaultValue or null if none found
var result = this._get(value);
if (minMatchScore === undefined) {
minMatchScore = .33
}
var result = this._get(value, minMatchScore);
if (!result && typeof defaultValue !== 'undefined') {

@@ -96,3 +101,3 @@ return defaultValue;

fuzzyset._get = function(value) {
fuzzyset._get = function(value, minMatchScore) {
var normalizedValue = this._normalizeStr(value),

@@ -107,3 +112,3 @@ result = this.exactSet[normalizedValue];

for (var gramSize = this.gramSizeUpper; gramSize >= this.gramSizeLower; --gramSize) {
results = this.__get(value, gramSize);
results = this.__get(value, gramSize, minMatchScore);
if (results) {

@@ -116,3 +121,3 @@ return results;

fuzzyset.__get = function(value, gramSize) {
fuzzyset.__get = function(value, gramSize, minMatchScore) {
var normalizedValue = this._normalizeStr(value),

@@ -186,7 +191,7 @@ matches = {},

var newResults = [];
for (var i = 0; i < results.length; ++i) {
if (results[i][0] == results[0][0]) {
newResults.push([results[i][0], this.exactSet[results[i][1]]]);
results.forEach(function(scoreWordPair) {
if (scoreWordPair[0] >= minMatchScore) {
newResults.push([scoreWordPair[0], this.exactSet[scoreWordPair[1]]]);
}
}
}.bind(this))
return newResults;

@@ -193,0 +198,0 @@ };

2

package.json
{
"name":"fuzzyset.js",
"description":"A fuzzy string set for JavaScript",
"version":"0.0.2",
"version":"0.0.3",
"homepage":"http://Glench.github.com/fuzzyset.js",

@@ -6,0 +6,0 @@ "repository":"git://github.com/Glench/fuzzyset.js.git",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc