objectwithPropertiesOfType(input, properties){
        if(!this.isObject(properties)){
            throw new TypeError('properties is not an object');
        }

        let names = Object.getOwnPropertyNames(properties);
        if(!this.objectwithProperties(input, names)){
            // a property don't exist
            return false;
        }

        for (var i = 0; i < names.length; i++){
            switch (properties[names[i]]){
                case 'number':
                    if(typeof input[names[i]] != 'number'){
                        return false;
                    }
                    break;
                case 'string':
                    if(typeof input[names[i]] != 'string'){
                        return false;
                    }
                    break;
                case 'boolean':
                    if(typeof input[names[i]] != 'boolean'){
                        return false;
                    }
                    break;
                case 'nonEmptyArray':
                    if(!this.nonEmptyArray(input[names[i]])){
                        return false;
                    }
                    break;
                case 'isObject':
                    if(!this.isObject(input[names[i]])){
                        return false;
                    }
                    break;
                case 'nonEmptyArrayOfObjects':
                    if(!this.nonEmptyArrayOfObjects(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isFilePath':
                    if(!this.isFilePath(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isRealtiveDirectory':
                    if(!this.isRealtiveDirectory(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isAbsoluteDirectory':
                    if(!this.isAbsoluteDirectory(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isHtmlSafe':
                    if(!this.isHtmlSafe(input[names[i]])){
                        return false;
                    }
                    break;

                default:
                    throw new TypeError(properties[names[i]] + ' is not a known type');
            }
        }

        return true;
    }
/**
     * Checks if a variable is an object, and has the given properties and that the 
     * properties are of the correct type. 
     * 
     * @param {mixed} input - the variable to test.
     * @param {opject} properties - the properties the object is required to have, 
     * and the type they are required to be. 
     * example - {'name':'string', 'description':'string', 'template':'boolean'}
     * @throws {TypeError} If properties isn't an object, it's empty, or if a validation type is unknown
     * @returns {boolean} if the input an object and has the required propertied
     */
Checks if a variable is an object, and has the given properties and that the
properties are of the correct type.

@param {mixed} input - the variable to test.
@param {opject} properties - the properties the object is required to have,
and the type they are required to be.
Checks if a variable is an object and has the given properties and that the properties are of the correct type . @param { mixed } input - the variable to test . @param { opject } properties - the properties the object is required to have and the type they are required to be .
objectwithPropertiesOfType(input, properties){
        if(!this.isObject(properties)){
            throw new TypeError('properties is not an object');
        }
        let names = Object.getOwnPropertyNames(properties);
        if(!this.objectwithProperties(input, names)){
            return false;
        }
        for (var i = 0; i < names.length; i++){
            switch (properties[names[i]]){
                case 'number':
                    if(typeof input[names[i]] != 'number'){
                        return false;
                    }
                    break;
                case 'string':
                    if(typeof input[names[i]] != 'string'){
                        return false;
                    }
                    break;
                case 'boolean':
                    if(typeof input[names[i]] != 'boolean'){
                        return false;
                    }
                    break;
                case 'nonEmptyArray':
                    if(!this.nonEmptyArray(input[names[i]])){
                        return false;
                    }
                    break;
                case 'isObject':
                    if(!this.isObject(input[names[i]])){
                        return false;
                    }
                    break;
                case 'nonEmptyArrayOfObjects':
                    if(!this.nonEmptyArrayOfObjects(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isFilePath':
                    if(!this.isFilePath(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isRealtiveDirectory':
                    if(!this.isRealtiveDirectory(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isAbsoluteDirectory':
                    if(!this.isAbsoluteDirectory(input[names[i]])){
                        return false;
                    }
                    break;
                 case 'isHtmlSafe':
                    if(!this.isHtmlSafe(input[names[i]])){
                        return false;
                    }
                    break;
                default:
                    throw new TypeError(properties[names[i]] + ' is not a known type');
            }
        }
        return true;
    }
objectwithPropertiesOfType ( input , properties ) { if ( ! this . isObject ( properties ) ) { throw new TypeError ( 'properties is not an object' ) ; } let names = Object . getOwnPropertyNames ( properties ) ; if ( ! this . objectwithProperties ( input , names ) ) { return false ; } for ( var i = 0 ; i < names . length ; i ++ ) { switch ( properties [ names [ i ] ] ) { case 'number' : if ( typeof input [ names [ i ] ] != 'number' ) { return false ; } break ; case 'string' : if ( typeof input [ names [ i ] ] != 'string' ) { return false ; } break ; case 'boolean' : if ( typeof input [ names [ i ] ] != 'boolean' ) { return false ; } break ; case 'nonEmptyArray' : if ( ! this . nonEmptyArray ( input [ names [ i ] ] ) ) { return false ; } break ; case 'isObject' : if ( ! this . isObject ( input [ names [ i ] ] ) ) { return false ; } break ; case 'nonEmptyArrayOfObjects' : if ( ! this . nonEmptyArrayOfObjects ( input [ names [ i ] ] ) ) { return false ; } break ; case 'isFilePath' : if ( ! this . isFilePath ( input [ names [ i ] ] ) ) { return false ; } break ; case 'isRealtiveDirectory' : if ( ! this . isRealtiveDirectory ( input [ names [ i ] ] ) ) { return false ; } break ; case 'isAbsoluteDirectory' : if ( ! this . isAbsoluteDirectory ( input [ names [ i ] ] ) ) { return false ; } break ; case 'isHtmlSafe' : if ( ! this . isHtmlSafe ( input [ names [ i ] ] ) ) { return false ; } break ; default : throw new TypeError ( properties [ names [ i ] ] + ' is not a known type' ) ; } } return true ; }
Checks if a variable is an object, and has the given properties and that the
 properties are of the correct type.
Checks if a variable is an object and has the given properties and that the properties are of the correct type .
// a property don't exist