0.0.1 • Published 7 years ago

number-masker v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

number-masker

A simple module for masking numeric values.

Build Status

Usage

Pass the value you want to replace symbols in to the replace function. The function takes two arguments: a value itself and an option hash. The options are:

  • replaceCount -- amount of digits to replace. Defaults to 3.
  • replaceSymbol -- symbol to replace digits with. Defaults to '*'.
  • numberDotSymbol -- symbol used to divide integer and fraction digits. Defaults to '.'.

Examples

const replace = require('number-masker).replace;

replace(123456) === '***456'; // true
replace(12345e-3) === '****45'; // true
replace(123.456) === '****56'; //true
replace('123,456', {
    replaceCount: 4,
    replaceSymbol: '?',
    numberDotSymbol: ','
}) === '?????56'; // true

License (MIT)

https://github.com/dlukanin/number-masker/blob/master/LICENSE