Files
NapCatQQ/.pnpm-store/v3/files/11/966d7d55260309d5757542bda54e96d79a14795217602b729151ea895b14e57bdb9d31863f2f046c068189a82478e5b01115bc74c9afe9b70808b078d1f0f3
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

32 lines
839 B
Plaintext

/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { Range } = require("semver")
const cache = new Map()
/**
* Get the `semver.Range` object of a given range text.
* @param {string} x The text expression for a semver range.
* @returns {Range|undefined} The range object of a given range text.
* It's null if the `x` is not a valid range text.
*/
module.exports = function getSemverRange(x) {
const stringVersion = String(x)
const cached = cache.get(stringVersion)
if (cached != null) {
return cached
}
try {
const output = new Range(stringVersion)
cache.set(stringVersion, output)
return output
} catch {
// Ignore parsing error.
cache.set(stringVersion, null)
}
}