obj.js
Methods
static assign(target) → {Object}
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 90](https://docs.videojs.com/utils_obj.js.html#line90)
Object.assign-style object shallow merge/extend.
Parameters:
Name | Type | Description |
---|---|---|
target | Object | |
…sources | Object |
Returns:
Object
static each(object, fn)
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 58](https://docs.videojs.com/utils_obj.js.html#line58)
Array-like iteration for objects.
Parameters:
Name | Type | Description |
---|---|---|
object | Object | The object to iterate over |
fn | obj:EachCallback | The callback function which is called for each key in the object. |
static isObject(value) → {boolean}
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 118](https://docs.videojs.com/utils_obj.js.html#line118)
Returns whether a value is an object of any kind - including DOM nodes, arrays, regular expressions, etc. Not functions, though.
This avoids the gotcha where using typeof
on a null
value results in 'object'
.
Parameters:
Name | Type | Description |
---|---|---|
value | Object |
Returns:
boolean
static isPlain(value) → {boolean}
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 129](https://docs.videojs.com/utils_obj.js.html#line129)
Returns whether an object appears to be a “plain” object - that is, a direct instance of Object
.
Parameters:
Name | Type | Description |
---|---|---|
value | Object |
Returns:
boolean
static reduce(object, fn, initialopt) → {Mixed}
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 79](https://docs.videojs.com/utils_obj.js.html#line79)
Array-like reduce for objects.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
object | Object | The Object that you want to reduce. | ||
fn | function | A callback function which is called for each key in the object. It receives the accumulated value and the per-iteration value and key as arguments. | ||
initial | Mixed | <optional> | 0 | Starting value |
Returns:
Mixed -
The final accumulated value.
Type Definitions
obj:EachCallback(value, key)
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 6](https://docs.videojs.com/utils_obj.js.html#line6)
Parameters:
Name | Type | Description |
---|---|---|
value | Mixed | The current key for the object that is being iterated over. |
key | string | The current key-value for object that is being iterated over |
obj:ReduceCallback(accum, value, key) → {Mixed}
[utils/obj.js](https://docs.videojs.com/utils_obj.js.html)
, [line 16](https://docs.videojs.com/utils_obj.js.html#line16)
Parameters:
Name | Type | Description |
---|---|---|
accum | Mixed | The value that is accumulating over the reduce loop. |
value | Mixed | The current key for the object that is being iterated over. |
key | string | The current key-value for object that is being iterated over |
Returns:
Mixed -
The new accumulated value.