64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
// Metro module 6377 (f6378).
|
|
import { isString, isRegExp, isVueViewModel } from "./isInstanceOf_6375";
|
|
export function isMatchingPattern(a0, a1, r4 = false) {
|
|
return !!isString(a0) && (isRegExp(a1) ? a1.test(a0) : !!isString(a1) && (r4 ? a0 === a1 : a0.includes(a1)));
|
|
}
|
|
export function safeJoin(a0, a1) {
|
|
if (Array.isArray(a0)) {
|
|
const r2 = [];
|
|
const length = a0.length;
|
|
let r6 = 0;
|
|
if (0 < length) {
|
|
do {
|
|
const r12 = a0[r6];
|
|
const r18 = r6;
|
|
try {
|
|
if (isVueViewModel(r12)) {
|
|
r2.push("[VueViewModel]");
|
|
} else {
|
|
r2.push(String(r12));
|
|
}
|
|
} catch ($e) {
|
|
r2.push("[value cannot be serialized]");
|
|
}
|
|
r6 = r18 + 1;
|
|
} while (r6 < a0.length);
|
|
}
|
|
return r2.join(a1);
|
|
}
|
|
return "";
|
|
}
|
|
export function snipLine(a0, a1) {
|
|
const length = a0.length;
|
|
if (length <= 150) {
|
|
return a0;
|
|
}
|
|
let r12 = Math.max((a1 > length ? length : a1) - 60, 0);
|
|
if (r12 < 5) {
|
|
r12 = 0;
|
|
}
|
|
let r16 = Math.min(r12 + 140, length);
|
|
if (r16 > length - 5) {
|
|
r16 = length;
|
|
}
|
|
if (r16 === length) {
|
|
r12 = Math.max(r16 - 140, 0);
|
|
}
|
|
const r22 = a0.slice(r12, r16);
|
|
const r24 = r12 > 0 ? `'{snip} ${r22}` : r22;
|
|
return r16 < length ? r24 + " {snip}" : r24;
|
|
}
|
|
export function stringMatchesSomePattern(c15694_0, r3 = [], r4 = false) {
|
|
let c15694_1 = r4;
|
|
return r3.some((item) => {
|
|
let r4 = c15694_1;
|
|
if (r4 === void 0) {
|
|
r4 = false;
|
|
}
|
|
return !!isString(c15694_0) && (isRegExp(item) ? item.test(c15694_0) : !!isString(item) && (r4 ? c15694_0 === item : c15694_0.includes(item)));
|
|
});
|
|
}
|
|
export function truncate(a0, r5 = 0) {
|
|
return typeof a0 === "string" ? r5 !== 0 ? a0.length <= r5 ? a0 : `${a0.slice(0, r5)}...` : a0 : a0;
|
|
}
|