0.5.0 • Published 3 years ago

karmia-utility-object v0.5.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

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'}}
0.5.0

3 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago