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

levenshtein-edit-distance

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

levenshtein-edit-distance - npm Package Compare versions

Comparing version 0.1.4 to 1.0.0

build.js

34

cli.js
#!/usr/bin/env node
'use strict';
/* eslint-disable no-process-exit */
/*

@@ -38,2 +40,8 @@ * Dependencies.

/*
* Whether to ignore case.
*/
var insensitive = false;
/**

@@ -46,3 +54,3 @@ * Get the distance for words.

function distance(values) {
return levenshtein(values[0], values[1]);
return levenshtein(values[0], values[1], insensitive);
}

@@ -66,2 +74,3 @@

' -v, --version output version number',
' -i, --insensitive ignore casing',
'',

@@ -105,2 +114,8 @@ 'Usage:',

var index = argv.indexOf('--insensitive');
if (index === -1) {
index = argv.indexOf('-i');
}
if (

@@ -111,3 +126,7 @@ argv.indexOf('--help') !== -1 ||

console.log(help());
} else if (
return;
}
if (
argv.indexOf('--version') !== -1 ||

@@ -117,3 +136,12 @@ argv.indexOf('-v') !== -1

console.log(pack.version);
} else if (argv.length) {
return;
}
if (index !== -1) {
argv.splice(index, 1);
insensitive = true;
}
if (argv.length) {
getDistance(argv.join(' '));

@@ -120,0 +148,0 @@ } else if (!expextPipeIn) {

@@ -7,3 +7,3 @@ var cache,

function levenshtein(value, other) {
function levenshtein(value, other, insensitive) {
var length,

@@ -33,2 +33,7 @@ lengthOther,

if (insensitive) {
value = value.toLowerCase();
other = other.toLowerCase();
}
index = 0;

@@ -35,0 +40,0 @@

15

package.json
{
"name": "levenshtein-edit-distance",
"version": "0.1.4",
"version": "1.0.0",
"description": "Levenshtein edit distance. No cruft. Real fast.",

@@ -23,6 +23,6 @@ "license": "MIT",

"devDependencies": {
"eslint": "^0.11.0",
"eslint": "^0.23.0",
"istanbul": "^0.3.0",
"jscs": "^1.0.0",
"jscs-jsdoc": "^0.4.0",
"jscs-jsdoc": "^1.0.0",
"matcha": "^0.6.0",

@@ -38,8 +38,5 @@ "mocha": "^2.0.0"

"test": "npm run test-api && npm run test-cli",
"lint-api": "eslint --rule no-cond-assign:false,strict:false index.js",
"lint-benchmark": "eslint --global suite,set,bench benchmark.js",
"lint-cli": "eslint --rule no-process-exit:false cli.js",
"lint-test": "eslint --env mocha test.js",
"lint-style": "jscs --reporter inline benchmark.js cli.js test.js",
"lint": "npm run lint-api && npm run lint-benchmark && npm run lint-cli && npm run lint-test && npm run lint-style",
"lint-api": "eslint .",
"lint-style": "jscs --reporter inline .",
"lint": "npm run lint-api && npm run lint-style",
"make": "npm run lint && npm run test-coverage",

@@ -46,0 +43,0 @@ "install-benchmark": "npm install natural fast-levenshtein levenshtein levenshtein-component levenshtein-deltas leven",

@@ -44,2 +44,5 @@ # levenshtein-edit-distance [![Build Status](https://img.shields.io/travis/wooorm/levenshtein-edit-distance.svg?style=flat)](https://travis-ci.org/wooorm/levenshtein-edit-distance) [![Coverage Status](https://img.shields.io/coveralls/wooorm/levenshtein-edit-distance.svg?style=flat)](https://coveralls.io/r/wooorm/levenshtein-edit-distance?branch=master)

/* Insensitive: */
levenshtein('DwAyNE', 'DUANE', true) === levenshtein('dwayne', 'DuAnE', true); // true
/* Order insensitive */

@@ -68,2 +71,3 @@ levenshtein('aarrgh', 'aargh') === levenshtein('aargh', 'aarrgh'); // true

-v, --version output version number
-i, --insensitive ignore casing

@@ -70,0 +74,0 @@ Usage:

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