From f921e9b6a1b14faa35b4c54364ddaed6b6e8fbc4 Mon Sep 17 00:00:00 2001 From: Rodolfo Date: Sat, 23 Apr 2022 00:16:01 -0300 Subject: [PATCH] minor change to exports --- README.md | 5 ++--- src/index.ts | 6 +++++- test/module.spec.ts | 2 +- test/object.spec.ts | 2 +- test/string.spec.ts | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 21fddab..3503e51 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,9 @@ $ yarn add blur-sensitive-data ## How to use ```typescript -import Obfuscator from 'blur-sensitive-data'; +const ob = require('blur-sensitive-data'); -const obf = new Obfuscator(); -obf.blur("Credit Card Number 4024-0071-4571-8614"); +const obf = new ob.Obfuscator().blur("Credit Card Number 4024-0071-4571-8614"); //output: Credit Card Number NOT_VISIBLE_SECURITY_REASON ``` diff --git a/src/index.ts b/src/index.ts index ba28b7a..cf14b50 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import {stringPatterns} from "./utils/stringsPatterns"; import {EStringPatterns} from "./typings/enums"; const sensitiveFields = require('sensitive-fields'); -export default class Obfuscator { +export class Obfuscator { static readonly EStringLookUpFields = EStringPatterns; readonly EStringLookUpFields = Obfuscator.EStringLookUpFields; @@ -51,3 +51,7 @@ export default class Obfuscator { return lookUpFields; } } + +module.exports = { + Obfuscator +} diff --git a/test/module.spec.ts b/test/module.spec.ts index d8d51c5..42734c5 100644 --- a/test/module.spec.ts +++ b/test/module.spec.ts @@ -1,4 +1,4 @@ -import Obfuscator from "../dist/cjs"; +import {Obfuscator} from "../dist/cjs"; import {TTargetFieldType} from "../src/typings/interfaces"; describe('Testing Obfuscator module and structures', () => { diff --git a/test/object.spec.ts b/test/object.spec.ts index 7915fbf..9ff66dc 100644 --- a/test/object.spec.ts +++ b/test/object.spec.ts @@ -1,4 +1,4 @@ -import Obfuscator from "../dist/cjs"; +import {Obfuscator} from "../dist/cjs"; const replacerText = `NOT_VISIBLE` diff --git a/test/string.spec.ts b/test/string.spec.ts index 77c6990..07db6ce 100644 --- a/test/string.spec.ts +++ b/test/string.spec.ts @@ -1,4 +1,4 @@ -import Obfuscator from "../dist/cjs/index"; +import {Obfuscator} from "../dist/cjs/index"; import {EStringPatterns} from "../src/typings/enums";