bin/number.js
function TypedNumber (config) {
    const number = this;

    // validate min
    if (config.hasOwnProperty('min') && !util.isNumber(config.min)) {
        const message = util.propertyErrorMessage('min', config.min, 'Must be a number.');
        throw Error(message);
    }

    // validate max
    if (config.hasOwnProperty('max') && !util.isNumber(config.max)) {
        const message = util.propertyErrorMessage('max', config.max, 'Must be a number.');
        throw Error(message);
    }

    // validate max is greater than min
    if (config.hasOwnProperty('max') && config.hasOwnProperty('min') && config.min > config.max) {
        const message = util.propertyErrorMessage('max', config.max, 'Must be a number that is less than the minimum: ' + config.min + '.');
        throw Error(message);
    }

    // define properties
    Object.defineProperties(number, {

        exclusiveMax: {
            /**
             * @property
             * @name TypedNumber#exclusiveMax
             * @type {boolean}
             */
            value: !!config.exclusiveMax,
            writable: false
        },

        exclusiveMin: {
            /**
             * @property
             * @name TypedNumber#exclusiveMin
             * @type {boolean}
             */
            value: !!config.exclusiveMin,
            writable: false
        },

        integer: {
            /**
             * @property
             * @name TypedNumber#integer
             * @type {boolean}
             */
            value: !!config.integer,
            writable: false
        },

        max: {
            /**
             * @property
             * @name TypedNumber#max
             * @type {number}
             */
            value: Number(config.max),
            writable: false
        },

        min: {
            /**
             * @property
             * @name TypedNumber#min
             * @type {number}
             */
            value: Number(config.min),
            writable: false
        }

    });

    return number;
}
function TypedNumber (config) {
    const number = this;

    // validate min
    if (config.hasOwnProperty('min') && !util.isNumber(config.min)) {
        const message = util.propertyErrorMessage('min', config.min, 'Must be a number.');
        throw Error(message);
    }

    // validate max
    if (config.hasOwnProperty('max') && !util.isNumber(config.max)) {
        const message = util.propertyErrorMessage('max', config.max, 'Must be a number.');
        throw Error(message);
    }

    // validate max is greater than min
    if (config.hasOwnProperty('max') && config.hasOwnProperty('min') && config.min > config.max) {
        const message = util.propertyErrorMessage('max', config.max, 'Must be a number that is less than the minimum: ' + config.min + '.');
        throw Error(message);
    }

    // define properties
    Object.defineProperties(number, {

        exclusiveMax: {
            /**
             * @property
             * @name TypedNumber#exclusiveMax
             * @type {boolean}
             */
            value: !!config.exclusiveMax,
            writable: false
        },

        exclusiveMin: {
            /**
             * @property
             * @name TypedNumber#exclusiveMin
             * @type {boolean}
             */
            value: !!config.exclusiveMin,
            writable: false
        },

        integer: {
            /**
             * @property
             * @name TypedNumber#integer
             * @type {boolean}
             */
            value: !!config.integer,
            writable: false
        },

        max: {
            /**
             * @property
             * @name TypedNumber#max
             * @type {number}
             */
            value: Number(config.max),
            writable: false
        },

        min: {
            /**
             * @property
             * @name TypedNumber#min
             * @type {number}
             */
            value: Number(config.min),
            writable: false
        }

    });

    return number;
}
function TypedNumber ( config ) { const number = this ; // validate min if ( config . hasOwnProperty ( 'min' ) && ! util . isNumber ( config . min ) ) { const message = util . propertyErrorMessage ( 'min' , config . min , 'Must be a number.' ) ; throw Error ( message ) ; } // validate max if ( config . hasOwnProperty ( 'max' ) && ! util . isNumber ( config . max ) ) { const message = util . propertyErrorMessage ( 'max' , config . max , 'Must be a number.' ) ; throw Error ( message ) ; } // validate max is greater than min if ( config . hasOwnProperty ( 'max' ) && config . hasOwnProperty ( 'min' ) && config . min > config . max ) { const message = util . propertyErrorMessage ( 'max' , config . max , 'Must be a number that is less than the minimum: ' + config . min + '.' ) ; throw Error ( message ) ; } // define properties Object . defineProperties ( number , { exclusiveMax : { /**
             * @property
             * @name TypedNumber#exclusiveMax
             * @type {boolean}
             */ value : ! ! config . exclusiveMax , writable : false } , exclusiveMin : { /**
             * @property
             * @name TypedNumber#exclusiveMin
             * @type {boolean}
             */ value : ! ! config . exclusiveMin , writable : false } , integer : { /**
             * @property
             * @name TypedNumber#integer
             * @type {boolean}
             */ value : ! ! config . integer , writable : false } , max : { /**
             * @property
             * @name TypedNumber#max
             * @type {number}
             */ value : Number ( config . max ) , writable : false } , min : { /**
             * @property
             * @name TypedNumber#min
             * @type {number}
             */ value : Number ( config . min ) , writable : false } } ) ; return number ; }
Create a TypedNumber instance.
@param {object} config
@returns {TypedNumber}
@augments Typed
@constructor
Create a TypedNumber instance .