build/SPE.js
function( arg, instance, defaultValue ) {
        'use strict';

        // If the argument being checked is an array, loop through
        // it and ensure all the values are of the correct type,
        // falling back to the defaultValue if any aren't.
        if ( Array.isArray( arg ) ) {
            for ( var i = arg.length - 1; i >= 0; --i ) {
                if ( instance !== undefined && arg[ i ] instanceof instance === false ) {
                    return defaultValue;
                }
            }

            return arg;
        }

        // If the arg isn't an array then just fallback to
        // checking the type.
        return this.ensureInstanceOf( arg, instance, defaultValue );
    }
function( arg, instance, defaultValue ) {
        'use strict';

        // If the argument being checked is an array, loop through
        // it and ensure all the values are of the correct type,
        // falling back to the defaultValue if any aren't.
        if ( Array.isArray( arg ) ) {
            for ( var i = arg.length - 1; i >= 0; --i ) {
                if ( instance !== undefined && arg[ i ] instanceof instance === false ) {
                    return defaultValue;
                }
            }

            return arg;
        }

        // If the arg isn't an array then just fallback to
        // checking the type.
        return this.ensureInstanceOf( arg, instance, defaultValue );
    }
function ( arg , instance , defaultValue ) { 'use strict' ; // If the argument being checked is an array, loop through // it and ensure all the values are of the correct type, // falling back to the defaultValue if any aren't. if ( Array . isArray ( arg ) ) { for ( var i = arg . length - 1 ; i >= 0 ; -- i ) { if ( instance !== undefined && arg [ i ] instanceof instance === false ) { return defaultValue ; } } return arg ; } // If the arg isn't an array then just fallback to // checking the type. return this . ensureInstanceOf ( arg , instance , defaultValue ) ; }
Given an array of values, ensure the instances of all items in the array
matches the given instance constructor falling back to a default value if
the check fails.

If given value isn't an Array, delegates to `SPE.utils.ensureInstanceOf`.

@param  {Array|Object} arg          The value to perform the instanceof check on.
@param  {Function} instance     The constructor of the instance to check against.
@param  {Object} defaultValue A default fallback value if instance check fails
@return {Object}              The given value if type check passes, or the default value if it fails.
Given an array of values ensure the instances of all items in the array matches the given instance constructor falling back to a default value if the check fails .