102 lines
2.7 KiB
JavaScript
102 lines
2.7 KiB
JavaScript
var a = /* @__PURE__ */ ((e) => (e[e.delete = 2] = "delete", e[e.reset = 1] = "reset", e))(a || {});
|
|
const d = (e) => ({
|
|
clear: function(t = 2) {
|
|
t === 1 ? Object.keys(e).forEach((n) => {
|
|
e[n] = void 0;
|
|
}) : t === 2 && Object.keys(e).forEach((n) => {
|
|
delete e[n];
|
|
});
|
|
},
|
|
replace: function(t) {
|
|
this.clear(
|
|
2
|
|
/* delete */
|
|
), Object.assign(e, t);
|
|
}
|
|
});
|
|
function m(...e) {
|
|
let t = e ?? [];
|
|
return {
|
|
test: function(n) {
|
|
if (t.length <= 1)
|
|
return t.length === 1 ? t[0] : [];
|
|
let i = n ?? function(s, r) {
|
|
return s === r;
|
|
};
|
|
return t.reduce((s, r) => (r && r.length > 0 && (s.length === 0 ? s.push(...r) : r.forEach((u) => {
|
|
s.some((l) => i(l, u)) || s.push(u);
|
|
})), s), []);
|
|
},
|
|
path: function(...n) {
|
|
return this.test((i, s) => n.every((r) => i[r] === s[r]));
|
|
}
|
|
};
|
|
}
|
|
function I(e, t, n) {
|
|
const i = t, s = n || t;
|
|
return function(r) {
|
|
const u = [], f = r.matchAll(e);
|
|
let l = 0;
|
|
for (const o of f) {
|
|
const c = r.slice(l, o.index);
|
|
c && u.push(s(c, !1)), u.push(i(o[0], !0)), l = o.index + o[0].length;
|
|
}
|
|
return l < r.length && u.push(s(r.slice(l), !1)), u;
|
|
};
|
|
}
|
|
function g(e, t) {
|
|
return typeof e == "string" && typeof t == "string" ? e.toLowerCase() === t.toLowerCase() : e === void 0 && t === void 0;
|
|
}
|
|
const O = (e, t) => {
|
|
for (let n = 0; n < e.length; n++) {
|
|
let i = e[n];
|
|
if (g(i, t))
|
|
return !0;
|
|
}
|
|
return !1;
|
|
}, h = (e) => e.replaceAll(/[\u4e00-\u9fa5]/g, "--").length, p = (e, t, n = " ") => {
|
|
const i = t - (h(e) - e.length);
|
|
return e.padEnd(i, n);
|
|
};
|
|
function E(e) {
|
|
const t = e.lastIndexOf(".");
|
|
return t === -1 ? "" : e.substring(t + 1);
|
|
}
|
|
function x(e) {
|
|
let t = e.lastIndexOf("/");
|
|
return t === -1 && (t = e.lastIndexOf("\\"), t === -1) ? e : e.substring(t + 1);
|
|
}
|
|
function b(e) {
|
|
const t = x(e), n = t.lastIndexOf(".");
|
|
return n === -1 ? t : t.substring(0, n);
|
|
}
|
|
function y(e, t = "win32") {
|
|
const n = t === "win32" ? "\\" : "/";
|
|
let i, s, r, u;
|
|
const f = e.lastIndexOf(n);
|
|
f === -1 ? (i = "", s = e) : (i = e.substring(0, f + 1), s = e.substring(f + 1));
|
|
const l = s.lastIndexOf(".");
|
|
return l === -1 ? (r = "", u = s) : (r = s.substring(l + 1), u = s.substring(0, l)), {
|
|
fileName: s,
|
|
fileNameNoExt: u,
|
|
fileExtName: r,
|
|
fullPath: e,
|
|
pathOnly: i
|
|
};
|
|
}
|
|
export {
|
|
a as RecordClearMode,
|
|
m as assignRecords,
|
|
g as equalsIgnoreCase,
|
|
E as getFileExt,
|
|
y as getFileInfo,
|
|
x as getFileName,
|
|
b as getFileNameWithoutExt,
|
|
O as includeIgnoreCase,
|
|
h as strLength,
|
|
p as strMonospacePad,
|
|
I as stringTokenizer,
|
|
d as withRecord
|
|
};
|
|
//# sourceMappingURL=index.es.js.map
|