aboutsummaryrefslogtreecommitdiff
path: root/node_modules/leven
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/leven
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
node_modules
Diffstat (limited to 'node_modules/leven')
-rw-r--r--node_modules/leven/index.js85
-rw-r--r--node_modules/leven/license21
-rw-r--r--node_modules/leven/package.json55
-rw-r--r--node_modules/leven/readme.md50
4 files changed, 0 insertions, 211 deletions
diff --git a/node_modules/leven/index.js b/node_modules/leven/index.js
deleted file mode 100644
index bb44b7919..000000000
--- a/node_modules/leven/index.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* eslint-disable no-nested-ternary */
-'use strict';
-var arr = [];
-var charCodeCache = [];
-
-module.exports = function (a, b) {
- if (a === b) {
- return 0;
- }
-
- var swap = a;
-
- // Swapping the strings if `a` is longer than `b` so we know which one is the
- // shortest & which one is the longest
- if (a.length > b.length) {
- a = b;
- b = swap;
- }
-
- var aLen = a.length;
- var bLen = b.length;
-
- if (aLen === 0) {
- return bLen;
- }
-
- if (bLen === 0) {
- return aLen;
- }
-
- // Performing suffix trimming:
- // We can linearly drop suffix common to both strings since they
- // don't increase distance at all
- // Note: `~-` is the bitwise way to perform a `- 1` operation
- while (aLen > 0 && (a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen))) {
- aLen--;
- bLen--;
- }
-
- if (aLen === 0) {
- return bLen;
- }
-
- // Performing prefix trimming
- // We can linearly drop prefix common to both strings since they
- // don't increase distance at all
- var start = 0;
-
- while (start < aLen && (a.charCodeAt(start) === b.charCodeAt(start))) {
- start++;
- }
-
- aLen -= start;
- bLen -= start;
-
- if (aLen === 0) {
- return bLen;
- }
-
- var bCharCode;
- var ret;
- var tmp;
- var tmp2;
- var i = 0;
- var j = 0;
-
- while (i < aLen) {
- charCodeCache[start + i] = a.charCodeAt(start + i);
- arr[i] = ++i;
- }
-
- while (j < bLen) {
- bCharCode = b.charCodeAt(start + j);
- tmp = j++;
- ret = j;
-
- for (i = 0; i < aLen; i++) {
- tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
- tmp = arr[i];
- ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
- }
- }
-
- return ret;
-};
diff --git a/node_modules/leven/license b/node_modules/leven/license
deleted file mode 100644
index 654d0bfe9..000000000
--- a/node_modules/leven/license
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/node_modules/leven/package.json b/node_modules/leven/package.json
deleted file mode 100644
index 4fd64bb22..000000000
--- a/node_modules/leven/package.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "name": "leven",
- "version": "2.1.0",
- "description": "Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm",
- "license": "MIT",
- "repository": "sindresorhus/leven",
- "author": {
- "name": "Sindre Sorhus",
- "email": "sindresorhus@gmail.com",
- "url": "sindresorhus.com"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "scripts": {
- "test": "xo && ava",
- "bench": "matcha bench.js"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "leven",
- "levenshtein",
- "distance",
- "algorithm",
- "algo",
- "string",
- "difference",
- "diff",
- "fast",
- "fuzzy",
- "similar",
- "similarity",
- "compare",
- "comparison",
- "edit",
- "text",
- "match",
- "matching"
- ],
- "devDependencies": {
- "ava": "^0.17.0",
- "fast-levenshtein": "^2.0.5",
- "ld": "^0.1.0",
- "levdist": "^2.0.0",
- "levenshtein": "^1.0.4",
- "levenshtein-component": "0.0.1",
- "levenshtein-edit-distance": "^2.0.0",
- "matcha": "^0.7.0",
- "natural": "^0.4.0",
- "talisman": "^0.18.0",
- "xo": "^0.16.0"
- }
-}
diff --git a/node_modules/leven/readme.md b/node_modules/leven/readme.md
deleted file mode 100644
index 9493c9f38..000000000
--- a/node_modules/leven/readme.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# leven [![Build Status](https://travis-ci.org/sindresorhus/leven.svg?branch=master)](https://travis-ci.org/sindresorhus/leven)
-
-> Measure the difference between two strings<br>
-> The fastest JS implementation of the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) algorithm
-
-
-## Install
-
-```
-$ npm install --save leven
-```
-
-
-## Usage
-
-```js
-const leven = require('leven');
-
-leven('cat', 'cow');
-//=> 2
-```
-
-
-## Benchmark
-
-```
-$ npm run bench
-```
-
-```
- 401,487 op/s » leven
- 371,707 op/s » talisman
- 264,191 op/s » levenshtein-edit-distance
- 152,923 op/s » fast-levenshtein
- 57,267 op/s » levenshtein-component
- 19,915 op/s » levdist
- 21,802 op/s » ld
- 18,079 op/s » natural
- 11,761 op/s » levenshtein
-```
-
-
-## Related
-
-- [leven-cli](https://github.com/sindresorhus/leven-cli) - CLI for this module
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)