@rimiti/maskme
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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

Package Sidebar

Install

npm i @rimiti/maskme

Weekly Downloads

8

Version

1.2.0

License

MIT

Unpacked Size

5.81 kB

Total Files

5

Last publish

Collaborators

  • rimiti