UNPKG

@darkobits/mask-string

Version:
14 lines (13 loc) 547 B
function maskAll(str, maskChar = "*") { if (typeof str !== "string") throw new TypeError(`Expected first argument to be of type "string", got "${typeof str}".`); if (typeof maskChar !== "string") throw new TypeError(`Expected second argument to be of type "string", got "${typeof maskChar}".`); if (maskChar.length !== 1) throw new Error(`Expected length of second argument to be 1, got ${maskChar.length}`); return [...str].map(() => maskChar).join(""); } export { maskAll as default }; //# sourceMappingURL=mask-all.js.map