🦹‍♀️ Replace sensitive string parts by asterisks (fully customizable).
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.editorconfig
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
package-lock.json
package.json
tsconfig.json
tsconfig.test.json
tslint.json

README.md

maskme

Build Status Coverage Status MIT license

Description

This module provide a powerful function to hide your sensible data with "lookbehind" regex.

Installation

$ npm install @rimiti/maskme --save

Using this module in other modules

import Maskme from '@rimiti/maskme';
const Maskme = require('@rimiti/maskme').default;

How to use it?

Keep 2 first and 2 last chars (default configuration: offsetLeft: 2, offsetRight: 2):

Maskme("4242424242424242");
// 42************42

Keep 4 first and 4 last chars and customize replacer:

Maskme("4242424242424242", {replaceBy: "x"});
// 42xxxxxxxxxxxx42

Kepp 2 last chars:

Maskme("4242424242424242", {offsetLeft: 0,});
// **************42

Keep 2 first chars:

Maskme("4242424242424242", {offsetRight: 0});
// 42**************

Hide all chars:

Maskme("4242424242424242", {offsetRight: 0, offsetLeft: 0});
// ****************

Keep 6 first and 5 last chars:

Maskme("4242424242424242", {offsetLeft: 6, offsetRight: 5});
// 424242*****24242

Hide nothing:

Maskme("4242424242424242", {offsetLeft: 30, offsetRight: 40});
// 4242424242424242

License

MIT © Dimitri DO BAIRRO