node package manager

mask-sensitive

Mak sensitive

Build Status Coverage Status dependencies Status devDependencies Status

Masks sensitive data with several different methods.

Installation

npm install mask-sensitive

Usage

var
  mask = require('mask-sensitive'),
  password = 'very sensitive data',
  masked = mask(password, {mode: 'secure'});

Modes

  • secure - return "***";
  • length - return equal to length number of "*";
  • half - mask first and last 1/4;
  • every - mask every third char;
  • middle - replace middle with "***";

By default, secure method is used.

Important

  • All data less then 4 chars will be masked with secure mode;
  • null is masked as ***.