maskdata 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -9
- package/index.js +11 -0
- package/lib/maskService/StringMask.js +1 -1
- package/package.json +7 -7
- package/tests/testEsmImports.mjs +51 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ maskdata is a Node.js module to mask various kinds of data. With the help of mas
|
|
|
3
3
|
|
|
4
4
|
# Table of Contents
|
|
5
5
|
- [Install maskdata](#install-maskdata)
|
|
6
|
-
- [Version 1.3.
|
|
6
|
+
- [Version 1.3.6 Features](#release-features)
|
|
7
7
|
- [Maskdata for Typescript](#maskdata-for-typescript)
|
|
8
8
|
- [How to Mask](#how-to-mask)
|
|
9
9
|
- [Card number](#mask-card-number)
|
|
@@ -32,6 +32,10 @@ maskdata is a Node.js module to mask various kinds of data. With the help of mas
|
|
|
32
32
|
<br/>
|
|
33
33
|
|
|
34
34
|
# Release Features
|
|
35
|
+
### Version 1.3.6
|
|
36
|
+
- Bug fix: https://github.com/Sumukha1496/maskdata/issues/62
|
|
37
|
+
### Version 1.3.5
|
|
38
|
+
- Bug fix for: https://github.com/Sumukha1496/maskdata/issues/55
|
|
35
39
|
### Version 1.3.4
|
|
36
40
|
- Dependency version upgrades
|
|
37
41
|
### Version 1.3.3
|
|
@@ -46,14 +50,6 @@ maskdata is a Node.js module to mask various kinds of data. With the help of mas
|
|
|
46
50
|
- https://github.com/Sumukha1496/maskdata/issues/47
|
|
47
51
|
- Fixed output length masking: [Mask Password](#mask-password) and [Mask String](#generic-string-masking)
|
|
48
52
|
- https://github.com/Sumukha1496/maskdata/issues/46
|
|
49
|
-
### Version 1.3.1
|
|
50
|
-
- Removal of maskJSONFields function: https://www.npmjs.com/package/maskdata/v/1.1.10#mask-fields-in-a-json
|
|
51
|
-
- String mask version2 for generic string masking in response to the below issues: [Details](#generic-string-masking)
|
|
52
|
-
- https://github.com/Sumukha1496/maskdata/issues/17
|
|
53
|
-
- https://github.com/Sumukha1496/maskdata/issues/40
|
|
54
|
-
- https://github.com/Sumukha1496/maskdata/issues/42
|
|
55
|
-
- Supporting generic string masking(string mask V2) as part of maskJson2: [generic String masking in a JSON](#json-mask-examples)
|
|
56
|
-
|
|
57
53
|
<br/>
|
|
58
54
|
|
|
59
55
|
## Maskdata for Typescript
|
package/index.js
CHANGED
|
@@ -62,3 +62,14 @@ class MaskData {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
module.exports = MaskData;
|
|
65
|
+
module.exports.maskPassword = MaskData.maskPassword;
|
|
66
|
+
module.exports.maskJSON2 = MaskData.maskJSON2;
|
|
67
|
+
module.exports.maskPhone = MaskData.maskPhone;
|
|
68
|
+
module.exports.maskEmail2 = MaskData.maskEmail2;
|
|
69
|
+
module.exports.maskCard = MaskData.maskCard;
|
|
70
|
+
module.exports.maskString = MaskData.maskString;
|
|
71
|
+
module.exports.maskStringV2 = MaskData.maskStringV2;
|
|
72
|
+
module.exports.maskUuid = MaskData.maskUuid;
|
|
73
|
+
module.exports.maskJwt = MaskData.maskJwt;
|
|
74
|
+
module.exports.getInnerProperty = MaskData.getInnerProperty;
|
|
75
|
+
module.exports.replaceValue = MaskData.replaceValue;
|
|
@@ -42,7 +42,7 @@ class StringMask {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
static maskStringV2(string, options) {
|
|
45
|
-
if (
|
|
45
|
+
if (string === null || string === undefined || typeof string === 'object') return string;
|
|
46
46
|
string = string + '';
|
|
47
47
|
if (options) {
|
|
48
48
|
options = MaskHelper.mapWithDefaultValues(options, Constants.defaultStringMaskV2Options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maskdata",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "Node module to mask various kinds of data in the required formats",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/Sumukha1496/maskdata"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"test": "mocha tests/test*.js --timeout 5000 --exit",
|
|
12
|
+
"test": "mocha 'tests/test*.{js,mjs}' --timeout 5000 --exit",
|
|
13
13
|
"coverage": "nyc --reporter=html --reporter=text npm run test",
|
|
14
14
|
"format": "prettier --write '**/*.{ts,js,json}'"
|
|
15
15
|
},
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"homepage": "https://www.npmjs.com/package/maskdata?activeTab=readme",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"lodash": "^4.
|
|
48
|
+
"lodash": "^4.18.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"chai": "^4.
|
|
52
|
-
"mocha": "^
|
|
51
|
+
"chai": "^4.5.0",
|
|
52
|
+
"mocha": "^11.8.0",
|
|
53
53
|
"mocha-junit-reporter": "^2.2.1",
|
|
54
|
-
"nyc": "^
|
|
55
|
-
"prettier": "^3.
|
|
54
|
+
"nyc": "^18.0.0",
|
|
55
|
+
"prettier": "^3.10.1",
|
|
56
56
|
"typescript": "^5.9.3"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
|
|
4
|
+
// 1. Named ESM imports + default ESM import
|
|
5
|
+
import MaskDataDefault, {
|
|
6
|
+
maskPassword,
|
|
7
|
+
maskJSON2,
|
|
8
|
+
maskPhone,
|
|
9
|
+
maskEmail2,
|
|
10
|
+
maskCard,
|
|
11
|
+
maskString,
|
|
12
|
+
maskStringV2,
|
|
13
|
+
maskUuid,
|
|
14
|
+
maskJwt,
|
|
15
|
+
getInnerProperty,
|
|
16
|
+
replaceValue,
|
|
17
|
+
} from '../index.js';
|
|
18
|
+
|
|
19
|
+
// 2. CommonJS require
|
|
20
|
+
const require = createRequire(import.meta.url);
|
|
21
|
+
const MaskDataCJS = require('../index.js');
|
|
22
|
+
|
|
23
|
+
describe('Native Node.js ESM and CommonJS interop', () => {
|
|
24
|
+
const namedExports = {
|
|
25
|
+
maskPassword,
|
|
26
|
+
maskJSON2,
|
|
27
|
+
maskPhone,
|
|
28
|
+
maskEmail2,
|
|
29
|
+
maskCard,
|
|
30
|
+
maskString,
|
|
31
|
+
maskStringV2,
|
|
32
|
+
maskUuid,
|
|
33
|
+
maskJwt,
|
|
34
|
+
getInnerProperty,
|
|
35
|
+
replaceValue,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
it('should expose all public methods as named ESM exports matching default and CJS exports', () => {
|
|
39
|
+
for (const [method, fn] of Object.entries(namedExports)) {
|
|
40
|
+
expect(fn).to.be.a('function');
|
|
41
|
+
expect(fn).to.equal(MaskDataDefault[method]);
|
|
42
|
+
expect(fn).to.equal(MaskDataCJS[method]);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should produce identical masking output across named ESM, default ESM, and CJS imports', () => {
|
|
47
|
+
expect(maskEmail2('alice@example.com')).to.equal(MaskDataCJS.maskEmail2('alice@example.com'));
|
|
48
|
+
expect(maskPhone('+85212345678')).to.equal(MaskDataCJS.maskPhone('+85212345678'));
|
|
49
|
+
expect(maskCard('1234-5678-1234-5678')).to.equal(MaskDataCJS.maskCard('1234-5678-1234-5678'));
|
|
50
|
+
});
|
|
51
|
+
});
|