schnee effeckt und fehler Korektur
This commit is contained in:
38
node_modules/find-versions/cli.js
generated
vendored
38
node_modules/find-versions/cli.js
generated
vendored
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var getStdin = require('get-stdin');
|
||||
var meow = require('meow');
|
||||
var findVersions = require('./');
|
||||
|
||||
var cli = meow([
|
||||
'Usage',
|
||||
' $ find-versions <string> [--first] [--loose]',
|
||||
' $ echo <string> | find-versions',
|
||||
'',
|
||||
'Example',
|
||||
' $ find-versions \'unicorns v1.2.3\'',
|
||||
' 1.2.3',
|
||||
'',
|
||||
' $ curl --version | find-versions --first',
|
||||
' 7.30.0',
|
||||
'',
|
||||
'Options',
|
||||
' --first Return the first match',
|
||||
' --loose Match non-semver versions like 1.88'
|
||||
]);
|
||||
|
||||
function init(data) {
|
||||
var ret = findVersions(data, {loose: cli.flags.loose});
|
||||
console.log(cli.flags.first ? ret[0] : ret.join('\n'));
|
||||
}
|
||||
|
||||
if (process.stdin.isTTY) {
|
||||
if (!cli.input[0]) {
|
||||
console.error('Expected a string');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
init(cli.input[0]);
|
||||
} else {
|
||||
getStdin(init);
|
||||
}
|
||||
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;
|
||||
19
node_modules/find-versions/index.js
generated
vendored
19
node_modules/find-versions/index.js
generated
vendored
@@ -1,18 +1,13 @@
|
||||
'use strict';
|
||||
var semverRegex = require('semver-regex');
|
||||
var arrayUniq = require('array-uniq');
|
||||
const semverRegex = require('semver-regex');
|
||||
|
||||
module.exports = function (str, opts) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
module.exports = (stringWithVersions, options = {}) => {
|
||||
if (typeof stringWithVersions !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof stringWithVersions}`);
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
const reLoose = new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, 'g');
|
||||
const matches = stringWithVersions.match(options.loose === true ? reLoose : semverRegex()) || [];
|
||||
|
||||
var reLoose = new RegExp('(?:' + semverRegex().source + ')|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)', 'g');
|
||||
var matches = str.match(opts.loose === true ? reLoose : semverRegex()) || [];
|
||||
|
||||
return arrayUniq(matches.map(function (el) {
|
||||
return el.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0');
|
||||
}));
|
||||
return [...new Set(matches.map(match => match.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0')))];
|
||||
};
|
||||
|
||||
20
node_modules/find-versions/license
generated
vendored
20
node_modules/find-versions/license
generated
vendored
@@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
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:
|
||||
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 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.
|
||||
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.
|
||||
|
||||
87
node_modules/find-versions/package.json
generated
vendored
87
node_modules/find-versions/package.json
generated
vendored
@@ -1,48 +1,43 @@
|
||||
{
|
||||
"name": "find-versions",
|
||||
"version": "1.2.1",
|
||||
"description": "Find semver versions in a string: `unicorn 1.0.0` → `1.0.0`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-versions",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bin": "cli.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cli-app",
|
||||
"cli",
|
||||
"semver",
|
||||
"version",
|
||||
"versions",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"matching",
|
||||
"semantic",
|
||||
"find",
|
||||
"extract",
|
||||
"get"
|
||||
],
|
||||
"dependencies": {
|
||||
"array-uniq": "^1.0.0",
|
||||
"get-stdin": "^4.0.1",
|
||||
"meow": "^3.5.0",
|
||||
"semver-regex": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
}
|
||||
"name": "find-versions",
|
||||
"version": "3.2.0",
|
||||
"description": "Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-versions",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"semver",
|
||||
"version",
|
||||
"versions",
|
||||
"regex",
|
||||
"regexp",
|
||||
"match",
|
||||
"matching",
|
||||
"semantic",
|
||||
"find",
|
||||
"extract",
|
||||
"get"
|
||||
],
|
||||
"dependencies": {
|
||||
"semver-regex": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
55
node_modules/find-versions/readme.md
generated
vendored
55
node_modules/find-versions/readme.md
generated
vendored
@@ -1,22 +1,22 @@
|
||||
# find-versions [](https://travis-ci.org/sindresorhus/find-versions)
|
||||
# find-versions [](https://travis-ci.com/sindresorhus/find-versions)
|
||||
|
||||
> Find semver versions in a string: `unicorn 1.0.0` → `1.0.0`
|
||||
> Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save find-versions
|
||||
$ npm install find-versions
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var findVersions = require('find-versions');
|
||||
const findVersions = require('find-versions');
|
||||
|
||||
findVersions('unicorn 1.0.0 rainbow v2.3.4+build.1');
|
||||
//=> ['1.0.0', '2.3.4+build.1']
|
||||
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']
|
||||
@@ -25,48 +25,29 @@ findVersions('cp (GNU coreutils) 8.22', {loose: true});
|
||||
|
||||
## API
|
||||
|
||||
### findVersions(input, options)
|
||||
### findVersions(stringWithVersions, [options])
|
||||
|
||||
#### input
|
||||
#### stringWithVersions
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
#### options.loose
|
||||
#### options
|
||||
|
||||
Type: `boolean`
|
||||
Type: `Object`
|
||||
|
||||
##### loose
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Also match non-semver versions like `1.88`.
|
||||
They're coerced into semver compliant versions.
|
||||
Also match non-semver versions like `1.88`. They're coerced into semver compliant versions.
|
||||
|
||||
|
||||
## CLI
|
||||
## Related
|
||||
|
||||
```
|
||||
$ npm install --global find-versions
|
||||
```
|
||||
|
||||
```
|
||||
$ find-versions --help
|
||||
|
||||
Usage
|
||||
$ find-versions <string> [--first] [--loose]
|
||||
$ echo <string> | find-versions
|
||||
|
||||
Example
|
||||
$ find-versions 'unicorns v1.2.3'
|
||||
1.2.3
|
||||
|
||||
$ curl --version | find-versions --first
|
||||
7.30.0
|
||||
|
||||
Options
|
||||
--first Return the first match
|
||||
--loose Match non-semver versions like 1.88
|
||||
```
|
||||
- [find-versions-cli](https://github.com/sindresorhus/find-versions-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
||||
Reference in New Issue
Block a user