UNPKG

@e-group/utils

Version:

eGroup team utils that share across projects.

18 lines (15 loc) 512 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = deIdentification; 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)); }