新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports.isNumeric = isNumeric;
|
|
exports.hyphenToCamelCase = hyphenToCamelCase;
|
|
exports.trimEnd = trimEnd;
|
|
exports.kebabCase = kebabCase;
|
|
exports.replaceSpaces = replaceSpaces;
|
|
|
|
/**
|
|
* Determines if the specified string consists entirely of numeric characters.
|
|
*
|
|
* @param {*} [value]
|
|
* @returns {boolean}
|
|
*/
|
|
function isNumeric(value) {
|
|
return !Number.isNaN(value - parseFloat(value));
|
|
}
|
|
/**
|
|
* Convert a hyphenated string to camelCase.
|
|
*
|
|
* @param {string} string
|
|
* @returns {string}
|
|
*/
|
|
|
|
|
|
function hyphenToCamelCase(string) {
|
|
return string.replace(/-(.)/g, (match, chr) => chr.toUpperCase());
|
|
}
|
|
/**
|
|
* Trim the specified substring off the string. If the string does not end
|
|
* with the specified substring, this is a no-op.
|
|
*
|
|
* @param {string} haystack String to search in
|
|
* @param {string} needle String to search for
|
|
* @return {string}
|
|
*/
|
|
|
|
|
|
function trimEnd(haystack, needle) {
|
|
return haystack.endsWith(needle) ? haystack.slice(0, -needle.length) : haystack;
|
|
}
|
|
|
|
const KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
|
|
|
|
function kebabCase(str) {
|
|
return str.replace(KEBAB_REGEX, match => `-${match.toLowerCase()}`);
|
|
}
|
|
|
|
const SPACES_REGEXP = /[\t\r\n\u0085\u2028\u2029]+/g;
|
|
|
|
function replaceSpaces(str) {
|
|
return str.replace(SPACES_REGEXP, ' ');
|
|
} |