| | |
| | | /** @typedef {(SemVerRangeItem | SemVerRangeItem[])[]} SemVerRange */ |
| | | |
| | | /** |
| | | * Returns parsed version. |
| | | * @param {string} str version string |
| | | * @returns {SemVerRange} parsed version |
| | | */ |
| | | const parseVersion = (str) => { |
| | | /** |
| | | * Returns result. |
| | | * @param {str} str str |
| | | * @returns {VersionValue[]} result |
| | | */ |
| | |
| | | |
| | | /* eslint-disable eqeqeq */ |
| | | /** |
| | | * Returns true, iff a < b. |
| | | * @param {string} a version |
| | | * @param {string} b version |
| | | * @returns {boolean} true, iff a < b |
| | |
| | | module.exports.versionLt = versionLt; |
| | | |
| | | /** |
| | | * Returns parsed range. |
| | | * @param {string} str range string |
| | | * @returns {SemVerRange} parsed range |
| | | */ |
| | | module.exports.parseRange = (str) => { |
| | | /** |
| | | * Returns result. |
| | | * @param {string} str str |
| | | * @returns {VersionValue[]} result |
| | | */ |
| | |
| | | |
| | | // see https://docs.npmjs.com/misc/semver#range-grammar for grammar |
| | | /** |
| | | * Returns the sem ver range item. |
| | | * @param {string} str str |
| | | * @returns {SemVerRangeItem[]} |
| | | */ |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns the sem ver range item. |
| | | * |
| | | * @param {SemVerRangeItem[]} range range |
| | | * @returns {SemVerRangeItem[]} |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns result. |
| | | * |
| | | * @param {SemVerRangeItem[]} range |
| | | * @returns {SemVerRangeItem[]} result |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns the sem ver range. |
| | | * @param {string} str str |
| | | * @returns {SemVerRange} |
| | | */ |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns result. |
| | | * |
| | | * @param {SemVerRangeItem[][]} items items |
| | | * @param {number} fn fn |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns the sem ver range. |
| | | * @param {string} str str |
| | | * @returns {SemVerRange} |
| | | */ |
| | |
| | | const items = []; |
| | | const r = /[-0-9A-Za-z]\s+/g; |
| | | var start = 0; |
| | | /** @type {RegExpExecArray | null} */ |
| | | var match; |
| | | while ((match = r.exec(str))) { |
| | | const end = match.index + 1; |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Returns the sem ver range. |
| | | * @param {string} str str |
| | | * @returns {SemVerRange} |
| | | */ |
| | |
| | | |
| | | /* eslint-disable eqeqeq */ |
| | | /** |
| | | * Returns the string. |
| | | * @param {SemVerRange} range |
| | | * @returns {string} |
| | | */ |
| | |
| | | module.exports.rangeToString = rangeToString; |
| | | |
| | | /** |
| | | * Returns if version satisfy the range. |
| | | * @param {SemVerRange} range version range |
| | | * @param {string} version the version |
| | | * @returns {boolean} if version satisfy the range |
| | |
| | | module.exports.satisfy = satisfy; |
| | | |
| | | /** |
| | | * Returns the string. |
| | | * @param {SemVerRange | string | number | false | undefined} json |
| | | * @returns {string} |
| | | */ |