Skip to content

About

Transform object content based on defined criteria

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

31 Commits

Folders and files

Repository files navigation

Transmuter

Transform an object content based on defined criteria

Build Status Coverage Status Maintainability Language grade: JavaScript tested with jest code style: prettier

Install

$ npm install transmuter

Usage

const transmuter = require('transmuter');

const alterations = [
  { key: "password", val: "(.*)", replacement: "xxxxx" },
  { key: "token", val: "(.*)", replacement: "xxxxx" },
];

const account = {
  email: "[email protected]",
  password: "T%dt4e5x;2!",
  token: "eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp"
}

transmuter(alterations, account);
//=> { email: "john.doe@gmail.com", password: "xxxxx", token: "xxxxx" }

API

transmuter ⇒ Object

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

License

MIT © muceres

About

Transform object content based on defined criteria

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages