lakutata
Version:
An IoC-based universal application framework.
52 lines (36 loc) • 986 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
function e(e, t) {
return c(e, t).map(n(t?.locale)).join(" ");
}
const t = /([\p{Ll}\d])(\p{Lu})/gu;
const r = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
const o = /(\d)(\p{Ll})/gu;
const p = /(\p{L})(\d)/gu;
const l = /[^\p{L}\d]+/giu;
const s = "$1\0$2";
function c(e, c) {
let n = e.replace(t, s).replace(r, s);
if (c && c.separateNumbers) {
n = n.replace(o, s).replace(p, s);
}
n = n.replace(l, "\0");
let a = 0;
let u = n.length;
while (n.charAt(a) === "\0") a++;
if (a === u) return [];
while (n.charAt(u - 1) === "\0") u--;
return n.slice(a, u).split(/\0/g);
}
function n(e) {
return e === false ? e => e.toLowerCase() : t => t.toLocaleLowerCase(e);
}
function a(e) {
return e === false ? e => e.toUpperCase() : t => t.toLocaleUpperCase(e);
}
exports.NoCase = e;
exports.Split = c;
exports.ToLower = n;
exports.ToUpper = a;