unshift(object, path, value) ⇒ Object | Array.<any>
one of additional functions to work with array items
Returns: Object | Array.<any> - updated object
Params
- object Object|Array.<any>- object to update
- path string|Array.<string>- path to be updated
- value *- value to be added
Description
import { unshift } from 'immutable-object-update';
const state = {
    a: {
        b: [ 1 ]
    }
};
const updated = unshift(state, [ 'a', 'b' ], 0);
// or
const updated = unshift(state, 'a.b', 0);
As a result we will receive new object with structure below:
{
    a: {
        b: [ 0, 1 ]
    }
}