настройка webpack
This commit is contained in:
22
node_modules/levenary/LICENSE
generated
vendored
Normal file
22
node_modules/levenary/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Tan Li Hau
|
||||
|
||||
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.
|
||||
41
node_modules/levenary/README.md
generated
vendored
Normal file
41
node_modules/levenary/README.md
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# levenary
|
||||
|
||||
[](https://www.npmjs.com/package/levenary)
|
||||
[](https://github.com/tanhauhau/levenary/actions)
|
||||
|
||||
> Given a string, A and an array of strings XS, return the string X from XS whose Levenshtein distance from A is minimal.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install levenary
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import levenary from 'levenary';
|
||||
|
||||
levenary('cat', ['cow', 'dog', 'pig']);
|
||||
//=> 'cow'
|
||||
```
|
||||
|
||||
## Why `levenary`?
|
||||
1. Based on [leven](https://github.com/sindresorhus/leven), the fastest JS implementation of the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance)
|
||||
1. Only 1 API. Simple and clean. If you want more, please use [didyoumean2](https://www.npmjs.com/package/didyoumean2).
|
||||
1. [Flow](http://flow.org/) and [TypeScript](http://typescriptlang.org/) support.
|
||||
|
||||
## Benchmark
|
||||
|
||||
```
|
||||
$ npm run bench
|
||||
```
|
||||
|
||||
```
|
||||
311,915 op/s » levenary
|
||||
74,030 op/s » didyoumean
|
||||
141,423 op/s » didyoumean2
|
||||
```
|
||||
|
||||
15
node_modules/levenary/index.d.ts
generated
vendored
Normal file
15
node_modules/levenary/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
declare module "levenary" {
|
||||
/**
|
||||
Return the string within `array`, whose Levenshtein distance from `str` is minimal.
|
||||
|
||||
@example
|
||||
```
|
||||
import levenary from 'levenary';
|
||||
|
||||
levenary('cat', ['cow', 'dog', 'pig']);
|
||||
//=> 'cow'
|
||||
```
|
||||
*/
|
||||
const levenary: (str: string, array: string[]) => string;
|
||||
export default levenary;
|
||||
}
|
||||
15
node_modules/levenary/index.flow.js
generated
vendored
Normal file
15
node_modules/levenary/index.flow.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
declare module "levenary" {
|
||||
/**
|
||||
Return the string within `array`, whose Levenshtein distance from `str` is minimal.
|
||||
|
||||
@example
|
||||
```
|
||||
import levenary from 'levenary';
|
||||
|
||||
levenary('cat', ['cow', 'dog', 'pig']);
|
||||
//=> 'cow'
|
||||
```
|
||||
*/
|
||||
declare function levenary (str: string, array: string[]): string;
|
||||
declare export default typeof levenary;
|
||||
}
|
||||
27
node_modules/levenary/index.js
generated
vendored
Normal file
27
node_modules/levenary/index.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = levenArray;
|
||||
|
||||
var _leven = _interopRequireDefault(require("leven"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function levenArray(str, array) {
|
||||
var minLeven = Number.POSITIVE_INFINITY;
|
||||
var result = undefined;
|
||||
|
||||
for (var _i2 = 0; _i2 < array.length; _i2++) {
|
||||
var item = array[_i2];
|
||||
var distance = (0, _leven.default)(str, item);
|
||||
|
||||
if (distance < minLeven) {
|
||||
minLeven = distance;
|
||||
result = item;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
14
node_modules/levenary/index.mjs
generated
vendored
Normal file
14
node_modules/levenary/index.mjs
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import leven from 'leven';
|
||||
|
||||
export default function levenArray(str, array) {
|
||||
let minLeven = Number.POSITIVE_INFINITY;
|
||||
let result = undefined;
|
||||
for(const item of array) {
|
||||
const distance = leven(str, item);
|
||||
if (distance < minLeven) {
|
||||
minLeven = distance;
|
||||
result = item;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
98
node_modules/levenary/package.json
generated
vendored
Normal file
98
node_modules/levenary/package.json
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
"_from": "levenary@^1.1.1",
|
||||
"_id": "levenary@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ==",
|
||||
"_location": "/levenary",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "levenary@^1.1.1",
|
||||
"name": "levenary",
|
||||
"escapedName": "levenary",
|
||||
"rawSpec": "^1.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-compilation-targets",
|
||||
"/@babel/preset-env"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/levenary/-/levenary-1.1.1.tgz",
|
||||
"_shasum": "842a9ee98d2075aa7faeedbe32679e9205f46f77",
|
||||
"_spec": "levenary@^1.1.1",
|
||||
"_where": "/Users/alinavigdorova/dev/storage-service-ui/node_modules/@babel/preset-env",
|
||||
"author": {
|
||||
"name": "Tan Li Hau",
|
||||
"email": "lhtan93@gmail.com"
|
||||
},
|
||||
"browserslist": "> 0.25%, not dead",
|
||||
"bugs": {
|
||||
"url": "https://github.com/tanhauhau/levenary/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"leven": "^3.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "[](https://www.npmjs.com/package/levenary) [](https://github.com/tanhauhau/levenary/actions)",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.5",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/plugin-transform-for-of": "^7.7.4",
|
||||
"@babel/preset-env": "^7.7.6",
|
||||
"babel-jest": "^24.9.0",
|
||||
"bench": "^0.3.6",
|
||||
"didyoumean": "^1.2.1",
|
||||
"didyoumean2": "^3.1.2",
|
||||
"jest": "^24.9.0",
|
||||
"matcha": "^0.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"files": [
|
||||
"index.mjs",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"index.flow.js"
|
||||
],
|
||||
"homepage": "https://github.com/tanhauhau/levenary#readme",
|
||||
"keywords": [
|
||||
"leven",
|
||||
"levenshtein",
|
||||
"distance",
|
||||
"array",
|
||||
"string",
|
||||
"algorithm",
|
||||
"algo",
|
||||
"string",
|
||||
"difference",
|
||||
"diff",
|
||||
"fast",
|
||||
"fuzzy",
|
||||
"similar",
|
||||
"similarity",
|
||||
"compare",
|
||||
"comparison",
|
||||
"edit",
|
||||
"text",
|
||||
"match",
|
||||
"matching"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"name": "levenary",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tanhauhau/levenary.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha bench.js",
|
||||
"build": "babel index.mjs --out-file index.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
Reference in New Issue
Block a user