update(key, value) {
        const existingVal = this.get(key);

        // not present yet in storage, store
        if (!isValid(existingVal)) {
            this.set(key, value);
        } else if (Array.isArray(existingVal)
            && Array.isArray(value)) {
            // is an array, extend original and set
            this.set(key, [...existingVal, ...value]);
        } else if (typeof existingVal === 'object'
            && typeof value === 'object') {
            // is an object, extend original and set
            this.set(key, { ...existingVal, ...value });
        } else {
            // incompatible or other primitive values, use normal set
            this.set(key, value);
        }
    }
/**
     * Similar to `set` method, but extends (shallow merges) the
     * original stored value if it is of type array or object.
     *
     * Note: The type of both stored as well as provided value
     * should match in order for the update to work. Also
     * the value should exist initially, otherwise the
     * behavior is equivalent to `set` method.
     *
     * @param {String} key  Storage key
     * @param {Mixed} value   Value to update
     */
Similar to `set` method, but extends (shallow merges) the
original stored value if it is of type array or object.

The type of both stored as well as provided value
should match in order for the update to work. Also
the value should exist initially, otherwise the
behavior is equivalent to `set` method.

@param {String} key  Storage key
@param {Mixed} value   Value to update
Similar to ` set ` method but extends ( shallow merges ) the original stored value if it is of type array or object . The type of both stored as well as provided value should match in order for the update to work . Also the value should exist initially otherwise the behavior is equivalent to ` set ` method . @param { String } key Storage key @param { Mixed } value Value to update
update(key, value) {
        const existingVal = this.get(key);
        if (!isValid(existingVal)) {
            this.set(key, value);
        } else if (Array.isArray(existingVal)
            && Array.isArray(value)) {
            this.set(key, [...existingVal, ...value]);
        } else if (typeof existingVal === 'object'
            && typeof value === 'object') {
            this.set(key, { ...existingVal, ...value });
        } else {
            this.set(key, value);
        }
    }
update ( key , value ) { const existingVal = this . get ( key ) ; if ( ! isValid ( existingVal ) ) { this . set ( key , value ) ; } else if ( Array . isArray ( existingVal ) && Array . isArray ( value ) ) { this . set ( key , [ ... existingVal , ... value ] ) ; } else if ( typeof existingVal === 'object' && typeof value === 'object' ) { this . set ( key , { ... existingVal , ... value } ) ; } else { this . set ( key , value ) ; } }
Similar to `set` method, but extends (shallow merges) the
 original stored value if it is of type array or object.
Similar to ` set ` method but extends ( shallow merges ) the original stored value if it is of type array or object .
// not present yet in storage, store // is an array, extend original and set // is an object, extend original and set // incompatible or other primitive values, use normal set