Methods to streamline the querying of object properties.

Methods

(inner) allOwnPropertiesOrFunctions(obj, predicateopt) → {Array.<string>}

For a given object only returns all the property or function names that are directly defined on the object itself. Here we do not consider what is defined on any of the prototypes in the prototype chain of the given object. If predicate is given, these can further be filtered by a custom condition.

Parameters:
NameTypeAttributesDescription
objObject

The object to collect the property and function names for.

predicatefunction<optional>

The predicate to filter the properties by further.

Returns:

The names of all the local properties or functions.

Type: 
Array.<string>

(inner) allProperties(obj, predicateopt) → {Array.<string>}

Gather all the property names of a given 'obj'. Can be further filtered by specifying a predicate.

Parameters:
NameTypeAttributesDescription
objObject

The object whose properties to collect.

predicatefunction<optional>

The predicate to filter the properties with.

Returns:

The list of all the names of the matching properties.

Type: 
Array.<string>

(inner) allPropertyDescriptors(obj) → {Object}

For a given object, traverses all prototypes in the proto chain and collects all property descriptors and merges them into one object.

Parameters:
NameTypeDescription
objObject

The object to collect the property descriptors for.

Returns:

The collection of property descriptors as a dictionary.

Type: 
Object

(inner) any(obj, predicate) → {boolean}

For a given obj and predicate checks wether any property defined for obj satisfies the condition defined by predicate.

Parameters:
NameTypeDescription
objObject

The object whose properties to check.

predicatefunction

The predicate to check the properties for.

Returns:

Wether or not any of the properties of the object satisfies the predicate.

Type: 
boolean

(inner) forEachOwn(object, func, contextopt) → {Array.<any>}

For a given object iterate over its local properties invoking func on each time.

Parameters:
NameTypeAttributesDescription
objectObject

The object whose properties to traverse.

funcfunction

The iteration function.

contextObject<optional>

The binding of this during the execution of func.

Returns:

The results of each iteration.

Type: 
Array.<any>

(inner) hash(obj) → {string}

Uses the property names of obj to generate a hash value.

Parameters:
NameTypeDescription
objObject

The object to generate a hash for.

Returns:

The computed hash.

Type: 
string

(inner) nameFor(object, value) → {string}

For a given object return the name of the property that is equal to value.

Parameters:
NameTypeDescription
objectObject

The object whose properties to check.

value*

The value to scan the properties for.

Returns:

The name of the property that stores the same value.

Type: 
string

(inner) own(object-) → {Array.<string>}

For a given object only returns all the property names that are directly defined on the object itself. Here we do not consider what is defined on any of the prototypes in the prototype chain of the given object.

Parameters:
NameTypeDescription
object-Object

The object to collect the property names for.

Returns:

The names of all the local properties.

Type: 
Array.<string>

(inner) ownValues(obj) → {Array.<any>}

Traverse all the values of a given object, only considering the ones directly defined on the object itself.

Parameters:
NameTypeDescription
objObject

The object to gather all the local values from.

Returns:

The list of all (own) values.

Type: 
Array.<any>

(inner) values(obj) → {Array.<any>}

Traverse all the values of a given object, including the ones defined in the prototype chain.

Parameters:
NameTypeDescription
objObject

The object to gather all the values from.

Returns:

The list of all values.

Type: 
Array.<any>