dist/spyfu-vuex-helpers.js
function findInstanceThen() {
        // this function supports two argument signatures. if the
        // first argument is an object, we will use that as the
        // config, and the second arg as the mutation handler
        var _parseArguments = parseArguments(arguments),
            config = _parseArguments.config,
            callback = _parseArguments.callback;

        return function (state, payload) {
            if (stateAndPayloadAreValid(config, state, payload)) {

                // find our instance based on the current configuration
                var instance = state[config.stateKey].find(function (obj) {
                    return obj[config.instanceKey] === payload[config.instanceKey];
                });

                // if the instance was found, execute our mutation callback
                if (instance) {
                    callback(instance, payload, state);
                }
            }
        };
    }
function findInstanceThen() {
        // this function supports two argument signatures. if the
        // first argument is an object, we will use that as the
        // config, and the second arg as the mutation handler
        var _parseArguments = parseArguments(arguments),
            config = _parseArguments.config,
            callback = _parseArguments.callback;

        return function (state, payload) {
            if (stateAndPayloadAreValid(config, state, payload)) {

                // find our instance based on the current configuration
                var instance = state[config.stateKey].find(function (obj) {
                    return obj[config.instanceKey] === payload[config.instanceKey];
                });

                // if the instance was found, execute our mutation callback
                if (instance) {
                    callback(instance, payload, state);
                }
            }
        };
    }
function findInstanceThen ( ) { // this function supports two argument signatures. if the // first argument is an object, we will use that as the // config, and the second arg as the mutation handler var _parseArguments = parseArguments ( arguments ) , config = _parseArguments . config , callback = _parseArguments . callback ; return function ( state , payload ) { if ( stateAndPayloadAreValid ( config , state , payload ) ) { // find our instance based on the current configuration var instance = state [ config . stateKey ] . find ( function ( obj ) { return obj [ config . instanceKey ] === payload [ config . instanceKey ] ; } ) ; // if the instance was found, execute our mutation callback if ( instance ) { callback ( instance , payload , state ) ; } } } ; }
Find a state instance, and execute a callback if found.

@param  {Object|Function}    required    the config object, or mutation callback
@param  {Function}           optional    mutation callback
@return {Function}
Find a state instance and execute a callback if found .