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

55
node_modules/sort-keys/index.js generated vendored Normal file
View File

@ -0,0 +1,55 @@
'use strict';
const isPlainObj = require('is-plain-obj');
module.exports = (obj, opts) => {
if (!isPlainObj(obj)) {
throw new TypeError('Expected a plain object');
}
opts = opts || {};
// DEPRECATED
if (typeof opts === 'function') {
throw new TypeError('Specify the compare function as an option instead');
}
const deep = opts.deep;
const seenInput = [];
const seenOutput = [];
const sortKeys = x => {
const seenIndex = seenInput.indexOf(x);
if (seenIndex !== -1) {
return seenOutput[seenIndex];
}
const ret = {};
const keys = Object.keys(x).sort(opts.compare);
seenInput.push(x);
seenOutput.push(ret);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const val = x[key];
if (deep && Array.isArray(val)) {
const retArr = [];
for (let j = 0; j < val.length; j++) {
retArr[j] = isPlainObj(val[j]) ? sortKeys(val[j]) : val[j];
}
ret[key] = retArr;
continue;
}
ret[key] = deep && isPlainObj(val) ? sortKeys(val) : val;
}
return ret;
};
return sortKeys(obj);
};

9
node_modules/sort-keys/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
MIT License
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.

72
node_modules/sort-keys/package.json generated vendored Normal file
View File

@ -0,0 +1,72 @@
{
"_from": "sort-keys@^2.0.0",
"_id": "sort-keys@2.0.0",
"_inBundle": false,
"_integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=",
"_location": "/sort-keys",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "sort-keys@^2.0.0",
"name": "sort-keys",
"escapedName": "sort-keys",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/cacheable-request/normalize-url"
],
"_resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz",
"_shasum": "658535584861ec97d730d6cf41822e1f56684128",
"_spec": "sort-keys@^2.0.0",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/cacheable-request/node_modules/normalize-url",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/sort-keys/issues"
},
"bundleDependencies": false,
"dependencies": {
"is-plain-obj": "^1.0.0"
},
"deprecated": false,
"description": "Sort the keys of an object",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/sort-keys#readme",
"keywords": [
"sort",
"object",
"keys",
"obj",
"key",
"stable",
"deterministic",
"deep",
"recursive",
"recursively"
],
"license": "MIT",
"name": "sort-keys",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/sort-keys.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "2.0.0"
}

60
node_modules/sort-keys/readme.md generated vendored Normal file
View File

@ -0,0 +1,60 @@
# sort-keys [![Build Status](https://travis-ci.org/sindresorhus/sort-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/sort-keys)
> Sort the keys of an object
Useful to get a deterministically ordered object, as the order of keys can vary between engines.
## Install
```
$ npm install --save sort-keys
```
## Usage
```js
const sortKeys = require('sort-keys');
sortKeys({c: 0, a: 0, b: 0});
//=> {a: 0, b: 0, c: 0}
sortKeys({b: {b: 0, a: 0}, a: 0}, {deep: true});
//=> {a: 0, b: {a: 0, b: 0}}
sortKeys({c: 0, a: 0, b: 0}, {
compare: (a, b) => -a.localeCompare(b)
});
//=> {c: 0, b: 0, a: 0}
```
## API
### sortKeys(input, [options])
Returns a new object with sorted keys.
#### input
Type: `Object`
#### options
##### deep
Type: `boolean`
Recursively sort keys.
##### compare
Type: `Function`
[Compare function.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)