Files
NapCatQQ/.pnpm-store/v3/files/51/c5775bc05d245a9160177db1a2a95b83b66cf4a7a3ed71a6ae26074ee6f2aae6a8388d0d1b919686d698e444bd55e00d10d3ccefc752a9fc4679973d298df2
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

31 lines
553 B
Plaintext

/**
* @file 解析参数数组
* @author mengke01(kekee000@gmail.com)
*/
const SEGMENT_REGEX = /-?\d+(?:\.\d+)?(?:e[-+]?\d+)?\b/g;
/**
* 获取参数值
*
* @param {string} d 参数
* @return {number} 参数值
*/
function getSegment(d) {
return +d.trim();
}
/**
* 解析参数数组
*
* @param {string} str 参数字符串
* @return {Array} 参数数组
*/
export default function (str) {
if (!str) {
return [];
}
const matchs = str.match(SEGMENT_REGEX);
return matchs ? matchs.map(getSegment) : [];
}