Methods to streamline the querying of object properties.
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
obj | Object | The object to collect the property and function names for. | |
predicate | function | <optional> | The predicate to filter the properties by further. |
- Source
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
.
Name | Type | Attributes | Description |
---|---|---|---|
obj | Object | The object whose properties to collect. | |
predicate | function | <optional> | The predicate to filter the properties with. |
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.
Name | Type | Description |
---|---|---|
obj | Object | The object to collect the property descriptors for. |
- Source
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
.
Name | Type | Description |
---|---|---|
obj | Object | The object whose properties to check. |
predicate | function | The predicate to check the properties for. |
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.
Name | Type | Attributes | Description |
---|---|---|---|
object | Object | The object whose properties to traverse. | |
func | function | The iteration function. | |
context | Object | <optional> | The binding of |
- Source
The results of each iteration.
- Type:
- Array.<any>
(inner) hash(obj) → {string}
Uses the property names of obj
to generate a hash value.
Name | Type | Description |
---|---|---|
obj | Object | The object to generate a hash for. |
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
.
Name | Type | Description |
---|---|---|
object | Object | The object whose properties to check. |
value | * | The value to scan the properties for. |
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.
Name | Type | Description |
---|---|---|
object- | Object | The object to collect the property names for. |
- Source
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.
Name | Type | Description |
---|---|---|
obj | Object | The object to gather all the local values from. |
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.
Name | Type | Description |
---|---|---|
obj | Object | The object to gather all the values from. |
The list of all values.
- Type:
- Array.<any>