UNPKG

@visactor/vmind

Version:

<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu

25 lines (16 loc) 858 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.extractFirstNumberInString = exports.replaceAll = exports.capitalize = exports.getLanguageOfText = void 0; const getLanguageOfText = text => (text || "").match(/[\u4e00-\u9fa5]/) ? "chinese" : "english"; exports.getLanguageOfText = getLanguageOfText; const capitalize = str => "string" != typeof str ? "" : str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); exports.capitalize = capitalize; const replaceAll = (originStr, replaceStr, newStr) => originStr.split(replaceStr).join(newStr); exports.replaceAll = replaceAll; const extractFirstNumberInString = str => { const matches = str.match(/\d+/g); return matches ? matches.map(Number)[0] : null; }; exports.extractFirstNumberInString = extractFirstNumberInString; //# sourceMappingURL=text.js.map