1.1.7 • Published 10 months ago

masking-js v1.1.7

Weekly downloads
8
License
ISC
Repository
-
Last release
10 months ago

masking-js

Project status

This version is support with Node 10 and upper version.

Version changes in version 1.0.1, Have 4 parameters (start, end, specialChar, data).

Version changes in version 1.1.1, Have 5 parameters (data, type, start, end, specialChar) and mapping by type from Json file about start, end and specialChar.

About

MaskingJs is Javascript libraries and tranform data to masking pattern

Available options

OptionDefault valueDescription
data''(Required) Original text for mask.
type''Type of mask data e.g. ACCOUNT, PHONE etc.
startnullFirst position of mask.
endnullLast position of mask.
specialChar''Point of split original text for mask with logic by type.

Available options (type)

typeDescription
NAMEMask text From the 2(start) position to last position. e.g. TEST mark to TExxxxx
CITIZEN_IDMask text From the 10(start) position to 12(end) position. e.g. 1234567890123 mark to 123456789xxx3
PASSPORTMask text From the 5(start) position to 7(end) position. e.g. 12345678 mark to 1234xxx8
PHONEMask text From the last 4 position. e.g. 1234567890 mark to 123456xxxx
EMAILMask text From the last 4 position after keyword @. e.g. testtest@test.com mark to testxxxx@test.com
ACCOUNT_NOMask text From the 0(start) position to 6(end) position. e.g. 1234567890 mark to xxxxxxx7890
CARD_NUMBERMask text From the 7(start) position to 12(end) position. e.g. 1234567890123456 mark to 123456xxxxxx3456
RELIGIONReturn empty text.
NATIONALITYReturn empty text.
CRIMINAL_HISTReturn empty text.
HEALTHReturn empty text.
ADDRESSReturn original text after keyword 'แขวง', 'ตำบล', 'Subdistrict', 'ต.', 'แขวง/ตำบล'. e.g. test Subdistrict test to Subdistrict test

Available output

return string data masking

Installation

To install this library, run:

$ npm install masking-js --save

Using this library (Angular , Ionic)

// Import the library
import * as MaskingJS from 'masking-js';

export class MarkingClass {
    mask : string = '';
    mask2 : string = '';
    constructor() {
       this.mask =  MaskingJS('1234567890123', 'CITIZEN_ID');
       this.mask2 =  MaskingJS('1234567890123', '', 10, 12,'');

    }
}
<p>{{mask}}</p>
<p>{{mask2}}</p>

Using this library (Next.js)

// Import the library
const MaskingJS = require('masking-js')

export default function Home() {
  return (<>
  <div>{MaskingJS('Testdata' , 'NAME')}</div>
  <div>{MaskingJS('Testdata' , '', 2, null,'')}</div>
  </>
  );
}

License

ISC © Sirintra Wannakheaw

1.1.7

10 months ago

1.1.6

10 months ago

1.1.5

12 months ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.1

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago