@e-group/utils
Version:
eGroup team utils that share across projects.
11 lines (10 loc) • 410 B
JavaScript
export default function deIdentification(str, loose) {
if (loose) {
const showLen = Math.round(str.length / 2);
const markLen = str.length - showLen;
const showStart = Math.round((str.length - showLen) / 2);
return str.replace(str.substr(showStart, markLen), '○'.repeat(markLen));
}
const markLen = str.length - 1;
return str.replace(str.substr(1, markLen), '○'.repeat(markLen));
}