karmia-utility-object

0.5.0 • Public • Published

karmia-utility-object

Karmia utility object module

Usage

const karmia_utility_object = require('karmia-utility-object').default,
    kobject = new karmia_utility_object();

isObject

  • value <*>

Check if value is an instance of Object

isPlainObject

  • value <*>

Check if value is a plain object

flip

  • object <Object>

Get object that exchanges key with their value

kobject.flip({a: 'A', b: 'B', c: 'C', d: 1, e: 2, f: 3});
// => {A: 'a', B: 'b', C: 'c', 1: d, 2: e, 3: f}

mergeProperties

  • object1 <Object>
  • object2 <Object>
const object1 = {
        a: {
            b: 'b',
            c: {
                d: 'd'
            }
        }
    },
    object2 = {
        a: {
            c: {
                e: 'e'
            },
            f: 'f'
        }
    };

kobject.mergeProperties(object1, object2);
// => {a: {b: 'b', c: {d: 'd', e: 'e'}, f: 'f'}}

removeProperty

  • object <Object>
  • property <Array|string>
const object = {
    a: 'a',
    b: {
        c: 'c'
        d: {
            e: 'e'
        }
    }
};

kobject.removeProperty(object, ['a', 'd']);
// => {b: {c: 'c'}}

Readme

Keywords

none

Package Sidebar

Install

npm i karmia-utility-object

Weekly Downloads

1

Version

0.5.0

License

MIT

Unpacked Size

17.1 kB

Total Files

8

Last publish

Collaborators

  • fujimaki-k