object-omit-ignore-case

0.0.3 • Public • Published

What you'll get?

Analog for lodash "omit", but with possibility to ignore case of omitted properties

1. Install the package

npm install object-omit-ignore-case --save

2. Use it as lodash omit, but put '/i' at the end of each property which case should be ignored

var req = {
    headers: {
        'X-HTTP-Header': 'value',
        Auth: 'value'
    },
    body: {
        LOG: {
            'Body-Param1': 1,
            'Body-Param2': 2,
        }
    }
};
 
var omit_ic = require('object-omit-ignore-case');
 
var objectToLog = omit_ic(req, ['headers.x-http-header/i', 'body.log/i.body-param1/i']);
/*
objectToLog = {
    headers: {
      Auth: 'value'
    },
    body: {
        LOG: {
            Body-Param2: 2
        }
    }
}
*/
 
 

That's it!

Package Sidebar

Install

npm i object-omit-ignore-case

Weekly Downloads

3

Version

0.0.3

License

ISC

Last publish

Collaborators

  • romanpanchenko