mqtt stuff added
This commit is contained in:
28
node_modules/leven/cli.js
generated
vendored
Executable file
28
node_modules/leven/cli.js
generated
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var pkg = require('./package.json');
|
||||
var leven = require('./');
|
||||
var argv = process.argv.slice(2);
|
||||
|
||||
function help() {
|
||||
console.log([
|
||||
'',
|
||||
' ' + pkg.description,
|
||||
'',
|
||||
' Example',
|
||||
' $ leven cat cow',
|
||||
' 2'
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
if (argv.length !== 2 || argv.indexOf('--help') !== -1) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
if (argv.indexOf('--version') !== -1) {
|
||||
console.log(pkg.version);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(leven(argv[0], argv[1]));
|
46
node_modules/leven/index.js
generated
vendored
Normal file
46
node_modules/leven/index.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
var arr = [];
|
||||
var charCodeCache = [];
|
||||
|
||||
module.exports = function (a, b) {
|
||||
if (a === b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var aLen = a.length;
|
||||
var bLen = b.length;
|
||||
|
||||
if (aLen === 0) {
|
||||
return bLen;
|
||||
}
|
||||
|
||||
if (bLen === 0) {
|
||||
return aLen;
|
||||
}
|
||||
|
||||
var bCharCode;
|
||||
var ret;
|
||||
var tmp;
|
||||
var tmp2;
|
||||
var i = 0;
|
||||
var j = 0;
|
||||
|
||||
while (i < aLen) {
|
||||
charCodeCache[i] = a.charCodeAt(i);
|
||||
arr[i] = ++i;
|
||||
}
|
||||
|
||||
while (j < bLen) {
|
||||
bCharCode = b.charCodeAt(j);
|
||||
tmp = j++;
|
||||
ret = j;
|
||||
|
||||
for (i = 0; i < aLen; i++) {
|
||||
tmp2 = bCharCode === charCodeCache[i] ? tmp : tmp + 1;
|
||||
tmp = arr[i];
|
||||
ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
21
node_modules/leven/license
generated
vendored
Normal file
21
node_modules/leven/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
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.
|
91
node_modules/leven/package.json
generated
vendored
Normal file
91
node_modules/leven/package.json
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"_from": "leven@^1.0.0",
|
||||
"_id": "leven@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=",
|
||||
"_location": "/leven",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "leven@^1.0.0",
|
||||
"name": "leven",
|
||||
"escapedName": "leven",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/commist"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz",
|
||||
"_shasum": "9144b6eebca5f1d0680169f1a6770dcea60b75c3",
|
||||
"_spec": "leven@^1.0.0",
|
||||
"_where": "/home/wn/workspace-node/PiAlive/node_modules/commist",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bin": {
|
||||
"leven": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/leven/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm",
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4",
|
||||
"fast-levenshtein": "^1.0.3",
|
||||
"ld": "^0.1.0",
|
||||
"levdist": "^1.0.0",
|
||||
"levenshtein": "^1.0.4",
|
||||
"levenshtein-component": "0.0.1",
|
||||
"levenshtein-edit-distance": "^0.1.0",
|
||||
"matcha": "^0.6.0",
|
||||
"natural": "^0.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/leven#readme",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"bin",
|
||||
"leven",
|
||||
"levenshtein",
|
||||
"distance",
|
||||
"algorithm",
|
||||
"algo",
|
||||
"string",
|
||||
"difference",
|
||||
"diff",
|
||||
"fast",
|
||||
"fuzzy",
|
||||
"similar",
|
||||
"similarity",
|
||||
"compare",
|
||||
"comparison",
|
||||
"edit",
|
||||
"text",
|
||||
"match",
|
||||
"matching"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "leven",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/leven.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
58
node_modules/leven/readme.md
generated
vendored
Normal file
58
node_modules/leven/readme.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# leven [](https://travis-ci.org/sindresorhus/leven)
|
||||
|
||||
> Measure the difference between two strings
|
||||
> The fastest JS implementation of the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) algorithm
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save leven
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var leven = require('leven');
|
||||
|
||||
leven('cat', 'cow');
|
||||
//=> 2
|
||||
```
|
||||
|
||||
|
||||
## Benchmark
|
||||
|
||||
```
|
||||
$ npm run bench
|
||||
```
|
||||
```
|
||||
343,757 op/s » leven
|
||||
264,625 op/s » levenshtein-edit-distance
|
||||
49,981 op/s » fast-levenshtein
|
||||
25,496 op/s » levenshtein-component
|
||||
18,240 op/s » levdist
|
||||
17,554 op/s » ld
|
||||
12,633 op/s » natural
|
||||
9,960 op/s » levenshtein
|
||||
```
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ npm install --global leven
|
||||
```
|
||||
|
||||
```
|
||||
$ leven --help
|
||||
|
||||
Example
|
||||
$ leven cat cow
|
||||
2
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
Reference in New Issue
Block a user