public/js-roguelike-skeleton/src/valid-targets-finder.js
function(target){
            // skip valid type check if value evaluating to false or empty array.
            if(!this.validTypes || !this.validTypes.length){
                return true;
            }

            for(var i = this.validTypes.length - 1; i >= 0; i--){
                var type = this.validTypes[i];
                if(target instanceof type){
                    return true;
                }
            }

            // no valid type match found
            return false;
        }
function(target){
            // skip valid type check if value evaluating to false or empty array.
            if(!this.validTypes || !this.validTypes.length){
                return true;
            }

            for(var i = this.validTypes.length - 1; i >= 0; i--){
                var type = this.validTypes[i];
                if(target instanceof type){
                    return true;
                }
            }

            // no valid type match found
            return false;
        }
function ( target ) { // skip valid type check if value evaluating to false or empty array. if ( ! this . validTypes || ! this . validTypes . length ) { return true ; } for ( var i = this . validTypes . length - 1 ; i >= 0 ; i -- ) { var type = this . validTypes [ i ] ; if ( target instanceof type ) { return true ; } } // no valid type match found return false ; }
Checks if a target object is an instance of a type in `this.validTypes`.
@method checkValidType
@param {Object} target - The target to be checked.
@return {Bool} `true` if valid.
Checks if a target object is an instance of a type in this . validTypes .