Transform an object content based on defined criteria
$ npm install transmuter
const transmuter = require('transmuter');
const alterations = [
{ key: "password", val: "(.*)", replacement: "xxxxx" },
{ key: "token", val: "(.*)", replacement: "xxxxx" },
];
const account = {
email: "john.doe@gmail.com",
password: "T%dt4e5x;2!",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp"
}
transmuter(alterations, account);
//=> { email: "john.doe@gmail.com", password: "xxxxx", token: "xxxxx" }Transform an object content based on defined criteria
Returns: Object - new object with alterations
Curriable:
| Param | Type | Description |
|---|---|---|
| alterations | Object[] |
describe changes to apply depanding on filters |
| object | Object |
object to apply alterations on |
MIT © muceres