deduplicate task parsing and masking helpers
This commit is contained in:
@@ -1,29 +1,16 @@
|
||||
import {
|
||||
maskPhone as maskPhoneValue,
|
||||
maskSecret as maskSecretValue,
|
||||
} from "../../../utils/masking.js";
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export function maskSecret(value: unknown) {
|
||||
const normalized = String(value || "").trim();
|
||||
if (!normalized) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (normalized.length <= 10) {
|
||||
return `${normalized.slice(0, 2)}****${normalized.slice(-2)}`;
|
||||
}
|
||||
|
||||
return `${normalized.slice(0, 6)}****${normalized.slice(-6)}`;
|
||||
return maskSecretValue(value);
|
||||
}
|
||||
|
||||
export function maskPhone(value: unknown) {
|
||||
const normalized = String(value || "").trim();
|
||||
if (!normalized) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (normalized.length < 7) {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
return `${normalized.slice(0, 3)}****${normalized.slice(-4)}`;
|
||||
return maskPhoneValue(value, { maskShort: false });
|
||||
}
|
||||
|
||||
export function mapAdminKuaishouEticketShopItem(item: JsonObject = {}) {
|
||||
|
||||
Reference in New Issue
Block a user