Comments (7)
Hi @kirillgroshkov, I no longer use this package. I think it's ok to close this issue. Thank you for asking
from scrubber-lib.
@hckhanh can you post a snippet of your code?
When I try
import { ScrubberConfig, Scrubber } from '@naturalcycles/scrubber-lib'
const scrubberConfig : ScrubberConfig = {
fields: {
password: {
scrubber: "staticScrubber",
params: {
replacement: "***"
}
},
secret: {
scrubber: "staticScrubber",
params: {
replacement: "***"
}
}
},
throwOnError: true, // default: false,
preserveFalsy: false // default: true
};
const object = {
"created_at": "2020-06-09T07:51:58.000Z",
"password": "abcd",
"secret": "secret",
"project_id": 1,
"updated_at": "2020-06-09T07:51:58.000Z"
}
const scrubber = new Scrubber(scrubberConfig)
const scrubbedObject = scrubber.scrub(object)
console.log(scrubbedObject)
I get the expected output:
{
created_at: '2020-06-09T07:51:58.000Z',
password: '***',
secret: '***',
project_id: 1,
updated_at: '2020-06-09T07:51:58.000Z'
}
Maybe the created_at
and updated_at
fields on your object are not really strings, but Date
objects? This library will work the best if you pass strings to it.
from scrubber-lib.
Perhaps, I am using Sequelize ORM for my database. I will check the type of created_at.
from scrubber-lib.
Another suggestion would be to improve scrubber-lib
to check if the field that it is processing is an object that has a toString()
function and use that if it is available. If you are interested in making such contribution, let me know! :)
from scrubber-lib.
I already checked the date fields, it's literally object (Date)
{
created_at: new Date('2020-06-09T07:51:58.000Z'),
password: '***',
secret: '***',
project_id: 1,
updated_at: new Date('2020-06-09T07:51:58.000Z')
}
I guess that it will return {}
from scrubber-lib.
This is my code:
const { Scrubber } = require("@naturalcycles/scrubber-lib");
const scrubberConfig = {
fields: {
password: {
scrubber: "staticScrubber",
params: {
replacement: "[SCRUBBED]"
}
},
passphrase: {
scrubber: "staticScrubber",
params: {
replacement: "[SCRUBBED]"
}
},
json_credentials: {
scrubber: "staticScrubber",
params: {
replacement: "[SCRUBBED]"
}
}
},
throwOnError: true, // default: false,
preserveFalsy: false // default: true
};
const scrubber = new Scrubber(scrubberConfig);
module.exports.scrubberData = function (data) {
return scrubber.scrub(data);
};
from scrubber-lib.
Just checking-in, is it still an issue?
from scrubber-lib.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scrubber-lib.