WIP - add extractor, generate snippet_data
This commit is contained in:
31
node_modules/find-versions/index.d.ts
generated
vendored
Normal file
31
node_modules/find-versions/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
declare namespace findVersions {
|
||||
interface Options {
|
||||
/**
|
||||
Also match non-semver versions like `1.88`. They're coerced into semver compliant versions.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly loose?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`.
|
||||
|
||||
@example
|
||||
```
|
||||
import findVersions = require('find-versions');
|
||||
|
||||
findVersions('unicorn v1.2.3 rainbow 2.3.4+build.1');
|
||||
//=> ['1.2.3', '2.3.4+build.1']
|
||||
|
||||
findVersions('cp (GNU coreutils) 8.22', {loose: true});
|
||||
//=> ['8.22.0']
|
||||
```
|
||||
*/
|
||||
declare function findVersions(
|
||||
stringWithVersions: string,
|
||||
options?: findVersions.Options
|
||||
): string[];
|
||||
|
||||
export = findVersions;
|
||||
14
node_modules/find-versions/index.js
generated
vendored
Normal file
14
node_modules/find-versions/index.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
const semverRegex = require('semver-regex');
|
||||
const arrayUniq = require('array-uniq');
|
||||
|
||||
module.exports = (stringWithVersions, options = {}) => {
|
||||
if (typeof stringWithVersions !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof stringWithVersions}`);
|
||||
}
|
||||
|
||||
const reLoose = new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, 'g');
|
||||
const matches = stringWithVersions.match(options.loose === true ? reLoose : semverRegex()) || [];
|
||||
|
||||
return arrayUniq(matches.map(match => match.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0')));
|
||||
};
|
||||
9
node_modules/find-versions/license
generated
vendored
Normal file
9
node_modules/find-versions/license
generated
vendored
Normal 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.
|
||||
21
node_modules/find-versions/node_modules/array-uniq/index.d.ts
generated
vendored
Normal file
21
node_modules/find-versions/node_modules/array-uniq/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
Create an array without duplicates.
|
||||
|
||||
@param array - The array to remove duplicates from.
|
||||
|
||||
@example
|
||||
```
|
||||
import arrayUniq = require('array-uniq');
|
||||
|
||||
arrayUniq([1, 1, 2, 3, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUniq(['foo', 'foo', 'bar', 'foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
*/
|
||||
declare function arrayUniq<ValueType>(
|
||||
array: ReadonlyArray<ValueType>
|
||||
): ValueType[];
|
||||
|
||||
export = arrayUniq;
|
||||
5
node_modules/find-versions/node_modules/array-uniq/index.js
generated
vendored
Normal file
5
node_modules/find-versions/node_modules/array-uniq/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const arrayUniq = array => [...new Set(array)];
|
||||
|
||||
module.exports = arrayUniq;
|
||||
9
node_modules/find-versions/node_modules/array-uniq/license
generated
vendored
Normal file
9
node_modules/find-versions/node_modules/array-uniq/license
generated
vendored
Normal 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.
|
||||
67
node_modules/find-versions/node_modules/array-uniq/package.json
generated
vendored
Normal file
67
node_modules/find-versions/node_modules/array-uniq/package.json
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "array-uniq@^2.1.0",
|
||||
"_id": "array-uniq@2.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-bdHxtev7FN6+MXI1YFW0Q8mQ8dTJc2S8AMfju+ZR77pbg2yAdVyDlwkaUI7Har0LyOMRFPHrJ9lYdyjZZswdlQ==",
|
||||
"_location": "/find-versions/array-uniq",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-uniq@^2.1.0",
|
||||
"name": "array-uniq",
|
||||
"escapedName": "array-uniq",
|
||||
"rawSpec": "^2.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/find-versions"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-2.1.0.tgz",
|
||||
"_shasum": "46603d5e28e79bfd02b046fcc1d77c6820bd8e98",
|
||||
"_spec": "array-uniq@^2.1.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/find-versions",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/array-uniq/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Create an array without duplicates",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/array-uniq#readme",
|
||||
"keywords": [
|
||||
"array",
|
||||
"set",
|
||||
"uniq",
|
||||
"unique",
|
||||
"duplicate",
|
||||
"remove"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "array-uniq",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/array-uniq.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
||||
28
node_modules/find-versions/node_modules/array-uniq/readme.md
generated
vendored
Normal file
28
node_modules/find-versions/node_modules/array-uniq/readme.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# array-uniq [](https://travis-ci.org/sindresorhus/array-uniq)
|
||||
|
||||
> Create an array without duplicates
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install array-uniq
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayUniq = require('array-uniq');
|
||||
|
||||
arrayUniq([1, 1, 2, 3, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUniq(['foo', 'foo', 'bar', 'foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
76
node_modules/find-versions/package.json
generated
vendored
Normal file
76
node_modules/find-versions/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "find-versions@^3.0.0",
|
||||
"_id": "find-versions@3.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-NCTfNiVzeE/xL+roNDffGuRbrWI6atI18lTJ22vKp7rs2OhYzMK3W1dIdO2TUndH/QMcacM4d1uWwgcZcHK69Q==",
|
||||
"_location": "/find-versions",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "find-versions@^3.0.0",
|
||||
"name": "find-versions",
|
||||
"escapedName": "find-versions",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-version"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.1.0.tgz",
|
||||
"_shasum": "10161f29cf3eb4350dec10a29bdde75bff0df32d",
|
||||
"_spec": "find-versions@^3.0.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/bin-version",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/find-versions/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"array-uniq": "^2.1.0",
|
||||
"semver-regex": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/find-versions#readme",
|
||||
"keywords": [
|
||||
"semver",
|
||||
"version",
|
||||
"versions",
|
||||
"regex",
|
||||
"regexp",
|
||||
"match",
|
||||
"matching",
|
||||
"semantic",
|
||||
"find",
|
||||
"extract",
|
||||
"get"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "find-versions",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/find-versions.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "3.1.0"
|
||||
}
|
||||
53
node_modules/find-versions/readme.md
generated
vendored
Normal file
53
node_modules/find-versions/readme.md
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# find-versions [](https://travis-ci.com/sindresorhus/find-versions)
|
||||
|
||||
> Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install find-versions
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const findVersions = require('find-versions');
|
||||
|
||||
findVersions('unicorn v1.2.3 rainbow 2.3.4+build.1');
|
||||
//=> ['1.2.3', '2.3.4+build.1']
|
||||
|
||||
findVersions('cp (GNU coreutils) 8.22', {loose: true});
|
||||
//=> ['8.22.0']
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findVersions(stringWithVersions, [options])
|
||||
|
||||
#### stringWithVersions
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### loose
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Also match non-semver versions like `1.88`. They're coerced into semver compliant versions.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [find-versions-cli](https://github.com/sindresorhus/find-versions-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user