dist/spyfu-vuex-helpers.js
function simple_instance_setters (setters) {
        var stateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'instances';
        var instanceKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';

        // loop over the setter keys and make a mutation for each
        return Object.keys(setters).reduce(function (mutations, name) {

            // attach our new mutation to result
            return Object.assign({}, mutations, defineProperty({}, name, function (state, payload) {
                // find the instance that we're mutating
                var instance = findInstance(state, stateKey, instanceKey, payload);

                if (instance) {
                    var value = findValue(payload, instanceKey);

                    // if the setter name has a dot, then resolve the
                    // state path before feeding our value into it.
                    if (setters[name].indexOf('.') > -1) {
                        var obj = setters[name].split('.');
                        var key = obj.pop();

                        resolveObjectPath(instance, obj)[key] = value;
                    } else {
                        // otherwise, just set the instance state to our value
                        instance[setters[name]] = value;
                    }
                } else {
                    // if the instance wasn't found, let the dev know with a warning
                    console.warn('An instance with an identifier of ' + instanceKey + ' was not found.');
                }
            }));
        }, {});
    }
function simple_instance_setters (setters) {
        var stateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'instances';
        var instanceKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';

        // loop over the setter keys and make a mutation for each
        return Object.keys(setters).reduce(function (mutations, name) {

            // attach our new mutation to result
            return Object.assign({}, mutations, defineProperty({}, name, function (state, payload) {
                // find the instance that we're mutating
                var instance = findInstance(state, stateKey, instanceKey, payload);

                if (instance) {
                    var value = findValue(payload, instanceKey);

                    // if the setter name has a dot, then resolve the
                    // state path before feeding our value into it.
                    if (setters[name].indexOf('.') > -1) {
                        var obj = setters[name].split('.');
                        var key = obj.pop();

                        resolveObjectPath(instance, obj)[key] = value;
                    } else {
                        // otherwise, just set the instance state to our value
                        instance[setters[name]] = value;
                    }
                } else {
                    // if the instance wasn't found, let the dev know with a warning
                    console.warn('An instance with an identifier of ' + instanceKey + ' was not found.');
                }
            }));
        }, {});
    }
function simple_instance_setters ( setters ) { var stateKey = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'instances' ; var instanceKey = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : 'id' ; // loop over the setter keys and make a mutation for each return Object . keys ( setters ) . reduce ( function ( mutations , name ) { // attach our new mutation to result return Object . assign ( { } , mutations , defineProperty ( { } , name , function ( state , payload ) { // find the instance that we're mutating var instance = findInstance ( state , stateKey , instanceKey , payload ) ; if ( instance ) { var value = findValue ( payload , instanceKey ) ; // if the setter name has a dot, then resolve the // state path before feeding our value into it. if ( setters [ name ] . indexOf ( '.' ) > - 1 ) { var obj = setters [ name ] . split ( '.' ) ; var key = obj . pop ( ) ; resolveObjectPath ( instance , obj ) [ key ] = value ; } else { // otherwise, just set the instance state to our value instance [ setters [ name ] ] = value ; } } else { // if the instance wasn't found, let the dev know with a warning console . warn ( 'An instance with an identifier of ' + instanceKey + ' was not found.' ) ; } } ) ) ; } , { } ) ; }
Simple mutations that set an instance's state equal to a value.

@param  {Object}
@param  {String}
@param  {String}
@return {Object}
Simple mutations that set an instance s state equal to a value .