src/safe_invoke.js
function safeInvokeForConfig({ fn, context, params, onNotInvoked }) {
    if (typeof fn === 'function') {
        let fnParams = params;
        if (typeof params === 'function') {
            fnParams = params();
        }

        // Warn if params or lazily evaluated params were given but not in an array
        if (fnParams != null && !Array.isArray(fnParams)) {
            if (process.env.NODE_ENV !== 'production') {
                // eslint-disable-next-line no-console
                console.warn("Params to pass into safeInvoke's fn is not an array. Ignoring...",
                             fnParams);
            }

            fnParams = null;
        }

        return {
            invoked: true,
            result: fn.apply(context, fnParams)
        };
    } else {
        if (typeof onNotInvoked === 'function') {
            onNotInvoked();
        }

        return { invoked: false };
    }
}
function safeInvokeForConfig({ fn, context, params, onNotInvoked }) {
    if (typeof fn === 'function') {
        let fnParams = params;
        if (typeof params === 'function') {
            fnParams = params();
        }

        // Warn if params or lazily evaluated params were given but not in an array
        if (fnParams != null && !Array.isArray(fnParams)) {
            if (process.env.NODE_ENV !== 'production') {
                // eslint-disable-next-line no-console
                console.warn("Params to pass into safeInvoke's fn is not an array. Ignoring...",
                             fnParams);
            }

            fnParams = null;
        }

        return {
            invoked: true,
            result: fn.apply(context, fnParams)
        };
    } else {
        if (typeof onNotInvoked === 'function') {
            onNotInvoked();
        }

        return { invoked: false };
    }
}
function safeInvokeForConfig ( { fn , context , params , onNotInvoked } ) { if ( typeof fn === 'function' ) { let fnParams = params ; if ( typeof params === 'function' ) { fnParams = params ( ) ; } // Warn if params or lazily evaluated params were given but not in an array if ( fnParams != null && ! Array . isArray ( fnParams ) ) { if ( process . env . NODE_ENV !== 'production' ) { // eslint-disable-next-line no-console console . warn ( "Params to pass into safeInvoke's fn is not an array. Ignoring..." , fnParams ) ; } fnParams = null ; } return { invoked : true , result : fn . apply ( context , fnParams ) } ; } else { if ( typeof onNotInvoked === 'function' ) { onNotInvoked ( ) ; } return { invoked : false } ; } }
Abstraction for safeInvoke's two call signatures
Abstraction for safeInvoke s two call signatures