yeet
This commit is contained in:
52
node_modules/compare-versions/CHANGELOG.md
generated
vendored
Normal file
52
node_modules/compare-versions/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
# Changelog
|
||||
|
||||
## [3.5.1](https://github.com/omichelsen/compare-versions/releases/tag/v3.5.1) - 2019-07-31
|
||||
- Refactor map compare with less code.
|
||||
|
||||
## [3.5.0](https://github.com/omichelsen/compare-versions/releases/tag/v3.5.0) - 2019-06-22
|
||||
- Add api returning true or false given a comparison operator.
|
||||
|
||||
## [3.4.0](https://github.com/omichelsen/compare-versions/releases/tag/v3.4.0) - 2018-08-30
|
||||
- Show rejected version in error message.
|
||||
|
||||
## [3.3.1](https://github.com/omichelsen/compare-versions/releases/tag/v3.3.1) - 2018-08-18
|
||||
- Fix TypeScript export declaration.
|
||||
|
||||
## [3.3.0](https://github.com/omichelsen/compare-versions/releases/tag/v3.3.0) - 2018-06-10
|
||||
- Add TypeScript declarations.
|
||||
|
||||
## [3.2.1](https://github.com/omichelsen/compare-versions/releases/tag/v3.2.1) - 2018-05-14
|
||||
- Fix rare bug in handling optional metadata.
|
||||
|
||||
## [3.2.0](https://github.com/omichelsen/compare-versions/releases/tag/v3.2.0) - 2018-05-13
|
||||
- Support Chromium version numbers.
|
||||
|
||||
## [3.1.0](https://github.com/omichelsen/compare-versions/releases/tag/v3.1.0) - 2017-09-25
|
||||
- Ignore leading zero in numbers.
|
||||
|
||||
## [3.0.1](https://github.com/omichelsen/compare-versions/releases/tag/v3.0.1) - 2017-04-01
|
||||
- Fix for leading 'v'.
|
||||
|
||||
## [3.0.0](https://github.com/omichelsen/compare-versions/releases/tag/v3.0.0) - 2016-08-08
|
||||
- Validate input data.
|
||||
|
||||
## [2.0.2](https://github.com/omichelsen/compare-versions/releases/tag/v2.0.2) - 2016-06-06
|
||||
- Handle numbers in pre-release versions.
|
||||
|
||||
## [2.0.1](https://github.com/omichelsen/compare-versions/releases/tag/v2.0.1) - 2015-09-13
|
||||
- Fix for versions with <3 digits.
|
||||
|
||||
## [2.0.0](https://github.com/omichelsen/compare-versions/releases/tag/v2.0.0) - 2015-09-07
|
||||
- Change global window accessor from returnExports to compareVersions.
|
||||
|
||||
## [1.1.2](https://github.com/omichelsen/compare-versions/releases/tag/v1.1.2) - 2015-05-03
|
||||
- Move patch check outside of the for loop.
|
||||
|
||||
## [1.1.1](https://github.com/omichelsen/compare-versions/releases/tag/v1.1.1) - 2015-05-03
|
||||
- Add a base 10 radix.
|
||||
|
||||
## [1.1.0](https://github.com/omichelsen/compare-versions/releases/tag/v1.1.0) - 2015-03-18
|
||||
- Added support for semver pre-release and metadata syntax.
|
||||
|
||||
## [1.0.0](https://github.com/omichelsen/compare-versions/releases/tag/v1.0.0) - 2015-03-18
|
||||
- Initial release.
|
21
node_modules/compare-versions/LICENSE
generated
vendored
Normal file
21
node_modules/compare-versions/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017 Ole Michelsen
|
||||
|
||||
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.
|
100
node_modules/compare-versions/README.md
generated
vendored
Normal file
100
node_modules/compare-versions/README.md
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
# compare-versions
|
||||
|
||||
[](https://travis-ci.org/omichelsen/compare-versions)
|
||||
[](https://coveralls.io/github/omichelsen/compare-versions?branch=master)
|
||||
[](https://bundlephobia.com/result?p=compare-versions)
|
||||
|
||||
Compare [semver](https://semver.org/) version strings to find greater, equal or lesser. Runs in the browser as well as Node.js/React Native etc. Has no dependencies and is tiny (~630 bytes gzipped).
|
||||
|
||||
This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. Additionally supports the following variations:
|
||||
|
||||
- Supports wildcards for minor and patch version like `1.0.x` or `1.0.*`.
|
||||
- Supports [Chromium version numbers](https://www.chromium.org/developers/version-numbers) with 4 parts, e.g. version `25.0.1364.126`.
|
||||
- Any leading `v` is ignored, e.g. `v1.0` is interpreted as `1.0`.
|
||||
- Leading zero is ignored, e.g. `1.01.1` is interpreted as `1.1.1`.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
$ npm install compare-versions
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Import
|
||||
|
||||
```javascript
|
||||
// ES6/TypeScript
|
||||
import compareVersions from 'compare-versions';
|
||||
|
||||
// Node
|
||||
var compareVersions = require('compare-versions');
|
||||
```
|
||||
|
||||
### Compare
|
||||
|
||||
```javascript
|
||||
compareVersions('10.1.8', '10.0.4'); // 1
|
||||
compareVersions('10.0.1', '10.0.1'); // 0
|
||||
compareVersions('10.1.1', '10.2.2'); // -1
|
||||
```
|
||||
|
||||
Can also be used for sorting:
|
||||
|
||||
```javascript
|
||||
var versions = [
|
||||
'1.5.19',
|
||||
'1.2.3',
|
||||
'1.5.5'
|
||||
]
|
||||
var sorted = versions.sort(compareVersions);
|
||||
/*
|
||||
[
|
||||
'1.2.3',
|
||||
'1.5.5',
|
||||
'1.5.19'
|
||||
]
|
||||
*/
|
||||
var sortDescending = versions.sort(compareVersions).reverse();
|
||||
/*
|
||||
[
|
||||
'1.5.19'
|
||||
'1.5.5',
|
||||
'1.2.3',
|
||||
]
|
||||
*/
|
||||
```
|
||||
|
||||
### "Human Readable" Compare
|
||||
|
||||
The normal compare function doesn't return a self-explanatory value (using `1`, `0` and `-1`).
|
||||
This version returns the boolean which fulfills the specified operator.
|
||||
|
||||
```js
|
||||
compareVersions.compare('10.1.8', '10.0.4', '>'); // return true
|
||||
compareVersions.compare('10.0.1', '10.0.1', '='); // return true
|
||||
compareVersions.compare('10.1.1', '10.2.2', '<'); // return true
|
||||
compareVersions.compare('10.1.1', '10.2.2', '<='); // return true
|
||||
compareVersions.compare('10.1.1', '10.2.2', '>='); // return false
|
||||
```
|
||||
|
||||
### Validate version numbers
|
||||
|
||||
Applies the same ruleset as used before comparing version numbers and returns a boolean:
|
||||
|
||||
```javascript
|
||||
compareVersions.validate('1.0.0-rc.1'); // return true
|
||||
compareVersions.validate('1.0-rc.1'); // return false
|
||||
compareVersions.validate('foo'); // return false
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
If included directly in the browser, `compareVersions()` is available on the global window:
|
||||
|
||||
```html
|
||||
<script src="compare-versions/index.js"></script>
|
||||
<script>
|
||||
window.compareVersions('10.0.0', '10.1.0');
|
||||
</script>
|
||||
```
|
59
node_modules/compare-versions/index.d.ts
generated
vendored
Normal file
59
node_modules/compare-versions/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
declare namespace compareVersions {
|
||||
/**
|
||||
* Allowed arithmetic operators
|
||||
*/
|
||||
type CompareOperator = '>' | '>=' | '=' | '<' | '<=';
|
||||
}
|
||||
|
||||
declare const compareVersions: {
|
||||
/**
|
||||
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
||||
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
|
||||
* @param firstVersion - First version to compare
|
||||
* @param secondVersion - Second version to compare
|
||||
* @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
|
||||
*/
|
||||
(firstVersion: string, secondVersion: string): 1 | 0 | -1;
|
||||
|
||||
/**
|
||||
* Compare [semver](https://semver.org/) version strings using the specified operator.
|
||||
*
|
||||
* @param firstVersion First version to compare
|
||||
* @param secondVersion Second version to compare
|
||||
* @param operator Allowed arithmetic operator to use
|
||||
* @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* compareVersions.compare('10.1.8', '10.0.4', '>'); // return true
|
||||
* compareVersions.compare('10.0.1', '10.0.1', '='); // return true
|
||||
* compareVersions.compare('10.1.1', '10.2.2', '<'); // return true
|
||||
* compareVersions.compare('10.1.1', '10.2.2', '<='); // return true
|
||||
* compareVersions.compare('10.1.1', '10.2.2', '>='); // return false
|
||||
* ```
|
||||
*/
|
||||
compare(
|
||||
firstVersion: string,
|
||||
secondVersion: string,
|
||||
operator: compareVersions.CompareOperator
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* Validate [semver](https://semver.org/) version strings.
|
||||
*
|
||||
* @param version Version number to validate
|
||||
* @returns `true` if the version number is a valid semver version number, `false` otherwise.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* compareVersions.validate('1.0.0-rc.1'); // return true
|
||||
* compareVersions.validate('1.0-rc.1'); // return false
|
||||
* compareVersions.validate('foo'); // return false
|
||||
* ```
|
||||
*/
|
||||
validate(
|
||||
version: string
|
||||
): boolean;
|
||||
};
|
||||
|
||||
export = compareVersions;
|
115
node_modules/compare-versions/index.js
generated
vendored
Normal file
115
node_modules/compare-versions/index.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
/* global define */
|
||||
(function (root, factory) {
|
||||
/* istanbul ignore next */
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define([], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.compareVersions = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
var semver = /^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
||||
|
||||
function indexOrEnd(str, q) {
|
||||
return str.indexOf(q) === -1 ? str.length : str.indexOf(q);
|
||||
}
|
||||
|
||||
function split(v) {
|
||||
var c = v.replace(/^v/, '').replace(/\+.*$/, '');
|
||||
var patchIndex = indexOrEnd(c, '-');
|
||||
var arr = c.substring(0, patchIndex).split('.');
|
||||
arr.push(c.substring(patchIndex + 1));
|
||||
return arr;
|
||||
}
|
||||
|
||||
function tryParse(v) {
|
||||
return isNaN(Number(v)) ? v : Number(v);
|
||||
}
|
||||
|
||||
function validate(version) {
|
||||
if (typeof version !== 'string') {
|
||||
throw new TypeError('Invalid argument expected string');
|
||||
}
|
||||
if (!semver.test(version)) {
|
||||
throw new Error('Invalid argument not valid semver (\''+version+'\' received)');
|
||||
}
|
||||
}
|
||||
|
||||
function compareVersions(v1, v2) {
|
||||
[v1, v2].forEach(validate);
|
||||
|
||||
var s1 = split(v1);
|
||||
var s2 = split(v2);
|
||||
|
||||
for (var i = 0; i < Math.max(s1.length - 1, s2.length - 1); i++) {
|
||||
var n1 = parseInt(s1[i] || 0, 10);
|
||||
var n2 = parseInt(s2[i] || 0, 10);
|
||||
|
||||
if (n1 > n2) return 1;
|
||||
if (n2 > n1) return -1;
|
||||
}
|
||||
|
||||
var sp1 = s1[s1.length - 1];
|
||||
var sp2 = s2[s2.length - 1];
|
||||
|
||||
if (sp1 && sp2) {
|
||||
var p1 = sp1.split('.').map(tryParse);
|
||||
var p2 = sp2.split('.').map(tryParse);
|
||||
|
||||
for (i = 0; i < Math.max(p1.length, p2.length); i++) {
|
||||
if (p1[i] === undefined || typeof p2[i] === 'string' && typeof p1[i] === 'number') return -1;
|
||||
if (p2[i] === undefined || typeof p1[i] === 'string' && typeof p2[i] === 'number') return 1;
|
||||
|
||||
if (p1[i] > p2[i]) return 1;
|
||||
if (p2[i] > p1[i]) return -1;
|
||||
}
|
||||
} else if (sp1 || sp2) {
|
||||
return sp1 ? -1 : 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
var allowedOperators = [
|
||||
'>',
|
||||
'>=',
|
||||
'=',
|
||||
'<',
|
||||
'<='
|
||||
];
|
||||
|
||||
var operatorResMap = {
|
||||
'>': [1],
|
||||
'>=': [0, 1],
|
||||
'=': [0],
|
||||
'<=': [-1, 0],
|
||||
'<': [-1]
|
||||
};
|
||||
|
||||
function validateOperator(op) {
|
||||
if (typeof op !== 'string') {
|
||||
throw new TypeError('Invalid operator type, expected string but got ' + typeof op);
|
||||
}
|
||||
if (allowedOperators.indexOf(op) === -1) {
|
||||
throw new TypeError('Invalid operator, expected one of ' + allowedOperators.join('|'));
|
||||
}
|
||||
}
|
||||
|
||||
compareVersions.validate = function(version) {
|
||||
return typeof version === 'string' && semver.test(version);
|
||||
}
|
||||
|
||||
compareVersions.compare = function (v1, v2, operator) {
|
||||
// Validate operator
|
||||
validateOperator(operator);
|
||||
|
||||
// since result of compareVersions can only be -1 or 0 or 1
|
||||
// a simple map can be used to replace switch
|
||||
var res = compareVersions(v1, v2);
|
||||
return operatorResMap[operator].indexOf(res) > -1;
|
||||
}
|
||||
|
||||
return compareVersions;
|
||||
}));
|
34
node_modules/compare-versions/package.json
generated
vendored
Normal file
34
node_modules/compare-versions/package.json
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "compare-versions",
|
||||
"version": "3.6.0",
|
||||
"description": "Compare semver version strings to find greater, equal or lesser.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/omichelsen/compare-versions.git"
|
||||
},
|
||||
"author": "Ole Michelsen",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/omichelsen/compare-versions/issues"
|
||||
},
|
||||
"homepage": "https://github.com/omichelsen/compare-versions#readme",
|
||||
"keywords": [
|
||||
"semver",
|
||||
"version",
|
||||
"compare",
|
||||
"browser",
|
||||
"node"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "nyc mocha"
|
||||
},
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "^7.0.1",
|
||||
"nyc": "^15.0.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user