WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

37
node_modules/meant/.npmignore generated vendored Normal file
View File

@ -0,0 +1,37 @@
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history

16
node_modules/meant/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,16 @@
script:
- "npm test"
language: node_js
node_js:
- "5"
- "4"
- iojs
- "0.12"
sudo: false
cache:
directories:
- node_modules

29
node_modules/meant/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,29 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.1"></a>
## [1.0.1](https://github.com/watilde/meant/compare/v1.0.0...v1.0.1) (2017-08-23)
### Bug Fixes
* **package:** tweak the line ([915d949](https://github.com/watilde/meant/commit/915d949))
<a name="1.0.0"></a>
# 1.0.0 (2016-09-08)
### Bug Fixes
* **deps:** install devDeps and update tests ([d766d6f](https://github.com/watilde/meant/commit/d766d6f))
* **run-script:** add npm run release command ([9387904](https://github.com/watilde/meant/commit/9387904))
* **test:** add test.js ([65b6e99](https://github.com/watilde/meant/commit/65b6e99))
* **travis:** add .travis.yml ([24d918c](https://github.com/watilde/meant/commit/24d918c))
### Features
* **new-meant:** add index.js ([7289b99](https://github.com/watilde/meant/commit/7289b99))

21
node_modules/meant/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Daijirō Wachi
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.

67
node_modules/meant/README.md generated vendored Normal file
View File

@ -0,0 +1,67 @@
# meant [![Build Status](https://travis-ci.org/watilde/meant.png?branch=master)](https://travis-ci.org/watilde/meant)
Like the `Did you mean?` in git for npm
## API
### meant(item, list)
+ item {String} A key for finding an approximate value
+ list {Array} A list for comparing with the item
```js
const meant = require('meant')
const result = meant('foa', ['foo', 'bar', 'baz'])
// => [ 'foo' ]
```
## Installation
Download node at [nodejs.org](http://nodejs.org) and install it, if you haven't already.
```sh
npm install meant --save
```
## Tests
```sh
npm install
npm test
```
```
> meant@1.0.0 test /Users/watilde/Development/meant
> standard && tap test.js
TAP version 13
# Subtest: test.js
# Subtest: test vs ['tast', 'tbst', 'tcst', 'foo']
ok 1 - list has tast
ok 2 - list has tbst
ok 3 - list has tcst
ok 4 - list doesn't have foo
1..4
ok 1 - test vs ['tast', 'tbst', 'tcst', 'foo'] # time=11.816ms
1..1
# time=44.006ms
ok 1 - test.js # time=249.154ms
1..1
# time=267.371ms
```
## Dependencies
None
## Dev Dependencies
- [standard](https://github.com/feross/standard): JavaScript Standard Style
- [standard-version](https://github.com/conventional-changelog/standard-version): replacement for `npm version` with automatic CHANGELOG generation
- [tap](https://github.com/tapjs/node-tap): A Test-Anything-Protocol library
## License
MIT
_Generated by [package-json-to-readme](https://github.com/zeke/package-json-to-readme)_

49
node_modules/meant/index.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
function levenshteinD (s1, s2) {
var d = []
var i = 0
for (i = 0; i <= s1.length; i++) d[i] = [i]
for (i = 0; i <= s2.length; i++) d[0][i] = i
s2.split('').forEach(function (c2, j) {
s1.split('').forEach(function (c1, i) {
if (c1 === c2) {
d[i + 1][j + 1] = d[i][j]
return
}
d[i + 1][j + 1] = Math.min(
d[i][j + 1] + 1,
d[i + 1][j] + 1,
d[i][j] + 1
)
})
})
return d[s1.length][s2.length]
}
function meant (scmd, commands) {
var d = []
var bestSimilarity = []
commands.forEach(function (cmd, i) {
var item = {}
item[levenshteinD(scmd, cmd)] = i
d.push(item)
})
d.sort(function (a, b) {
return Number(Object.keys(a)[0]) - Number(Object.keys(b)[0])
})
d.forEach(function (item) {
var key = Number(Object.keys(item)[0])
if (scmd.length / 2 >= key) {
bestSimilarity.push(commands[item[key]])
}
})
return bestSimilarity
}
module.exports = meant

55
node_modules/meant/package.json generated vendored Normal file
View File

@ -0,0 +1,55 @@
{
"_from": "meant@^1.0.1",
"_id": "meant@1.0.1",
"_inBundle": false,
"_integrity": "sha512-UakVLFjKkbbUwNWJ2frVLnnAtbb7D7DsloxRd3s/gDpI8rdv8W5Hp3NaDb+POBI1fQdeussER6NB8vpcRURvlg==",
"_location": "/meant",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "meant@^1.0.1",
"name": "meant",
"escapedName": "meant",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/gatsby/gatsby-cli"
],
"_resolved": "https://registry.npmjs.org/meant/-/meant-1.0.1.tgz",
"_shasum": "66044fea2f23230ec806fb515efea29c44d2115d",
"_spec": "meant@^1.0.1",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby/node_modules/gatsby-cli",
"author": {
"name": "Daijiro Wachi"
},
"bugs": {
"url": "https://github.com/watilde/meant/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Like the `Did you mean?` in git for npm",
"devDependencies": {
"standard": "^8.0.0",
"standard-version": "^2.4.0",
"tap": "^7.1.1"
},
"homepage": "https://github.com/watilde/meant#readme",
"keywords": [
"meant"
],
"license": "MIT",
"main": "index.js",
"name": "meant",
"repository": {
"type": "git",
"url": "git+https://github.com/watilde/meant.git"
},
"scripts": {
"release": "standard-version",
"test": "standard && tap test.js"
},
"version": "1.0.1"
}

11
node_modules/meant/test.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
var test = require('tap').test
var meant = require('./')
test('test vs [\'tast\', \'tbst\', \'tcst\', \'foo\']', function (t) {
var list = meant('test', ['tast', 'tbst', 'tcst', 'foo'])
t.notEqual(list.indexOf('tast'), -1, 'list has tast')
t.notEqual(list.indexOf('tbst'), -1, 'list has tbst')
t.notEqual(list.indexOf('tcst'), -1, 'list has tcst')
t.equal(list.indexOf('foo'), -1, 'list doesn\'t have foo')
t.end()
})