http-params-filter

1.0.0 • Public • Published

http-params-filter

Function to filter the credential value contained in the object such as http parameter.

install

npm install http-params-filter

usage

const f = require('http-params-filter')(['email', 'password', 'wallet', 'secret']);

const params = {
  user: {
    id: 1,
    email: 'hoge@example.com',
    password: 'hogehgoe',
    display_name: 'hogeo',
  },
  org: {
    name: 'orgName',
    email: 'org@example.com',
  },
  wallet: {
    number: '1111111111',
  },
  secret: 'secretValue',
};

const res = f(params);
// => {
//   user: {
//     id: 1,
//     email: '[FILTERD]',
//     password: '[FILTERD]',
//     display_name: 'hogeo',
//   },
//   org: {
//     name: 'orgName',
//     email: '[FILTERD]',
//   },
//   wallet: '[FILTERD]',
//   secret: '[FILTERD]'
// }

Readme

Keywords

none

Package Sidebar

Install

npm i http-params-filter

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

7.76 kB

Total Files

5

Last publish

Collaborators

  • kinosuke01