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

14 lines
323 B
Plaintext

'use strict';
module.exports = function (str, sep) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
sep = typeof sep === 'undefined' ? '_' : sep;
return str
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
.toLowerCase();
};