UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

11 lines (9 loc) 372 B
/** * Replaces all but the last num of characters with the specified mask character. */ var mask = function (cc) { var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; var mask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '*'; return `${cc}`.slice(-num).padStart(`${cc}`.length, mask); }; export default mask;