Object

Methods

(static) invert(object) → {Object}

Source:

Creates an object composed of the inverted keys and values of object. If object contains duplicate values, and subsequent values overwrite property assignments of previous values.

Example
const person = {
    fname: 'Stefan',
    lname: 'Lazarevic',
};

object_invert(person);
// => {
//        Stefan: 'fname',
//        Lazarevic: 'lname',
//    }
Parameters:
Name Type Description
object Object

The object to invert.

Throws:
TypeError
Returns:

Returns the new inverted object.

Type
Object

(static) keys(object) → {Array}

Source:

The object_keys function returns an array of a given object's own enumerable properties.

Example
const person = {
    fname: 'Stefan',
    lname: 'Lazarevic',
};

keys(person);
// => ['fname', 'lname']
Parameters:
Name Type Description
object Object

The object to query.

Returns:

Returns the array of property names.

Type
Array

(static) pluck(key, object)

Source:

Retrieves the value of a specified property from provided object.

Example
const person = {
    name: 'Stefan',
    address: {
        city: 'Belgrade',
        area: {
            name: 'Cukarica',
        }
    }
};

pluck('address.area.name', person);
// => 'Cukarica'

pluck('address.name.area', person);
// => undefined
Parameters:
Name Type Description
key String
object Object
Throws:
TypeError

(static) values(object) → {Array}

Source:

Creates an array of the own enumerable property values of object.

Example
const person = {
    fname: 'Stefan',
    lname: 'Lazarevic',
};

object_values(person);
// => ['Stefan', 'Lazarevic']
Parameters:
Name Type Description
object Object

The object to query.

Throws:
TypeError
Returns:

Returns the array of property values.

Type
Array