bin/string.js
function TypedString (config) {
    const string = this;

    // validate min length
    if (config.hasOwnProperty('minLength') && (!util.isInteger(config.minLength) || config.minLength < 0)) {
        const message = util.propertyErrorMessage('minLength', config.minLength, 'Must be an integer that is greater than or equal to zero.');
        throw Error(message);
    }
    const minLength = config.hasOwnProperty('minLength') ? config.minLength : 0;

    // validate max length
    if (config.hasOwnProperty('maxLength') && (!util.isInteger(config.maxLength) || config.maxLength < minLength)) {
        const message = util.propertyErrorMessage('maxLength', config.maxLength, 'Must be an integer that is greater than or equal to the minLength.');
        throw Error(message);
    }

    // validate pattern
    if (config.hasOwnProperty('pattern') && !(config.pattern instanceof RegExp)) {
        const message = util.propertyErrorMessage('pattern', config.pattern, 'Must be a regular expression object.');
        throw Error(message);
    }

    // define properties
    Object.defineProperties(string, {

        maxLength: {
            /**
             * @property
             * @name TypedString#maxLength
             * @type {number}
             */
            value: Math.round(config.maxLength),
            writable: false
        },

        minLength: {
            /**
             * @property
             * @name TypedString#minLength
             * @type {number}
             */
            value: Math.round(config.minLength),
            writable: false
        },

        pattern: {
            /**
             * @property
             * @name TypedString#pattern
             * @type {RegExp}
             */
            value: config.pattern,
            writable: false
        }

    });

    return string;
}
function TypedString (config) {
    const string = this;

    // validate min length
    if (config.hasOwnProperty('minLength') && (!util.isInteger(config.minLength) || config.minLength < 0)) {
        const message = util.propertyErrorMessage('minLength', config.minLength, 'Must be an integer that is greater than or equal to zero.');
        throw Error(message);
    }
    const minLength = config.hasOwnProperty('minLength') ? config.minLength : 0;

    // validate max length
    if (config.hasOwnProperty('maxLength') && (!util.isInteger(config.maxLength) || config.maxLength < minLength)) {
        const message = util.propertyErrorMessage('maxLength', config.maxLength, 'Must be an integer that is greater than or equal to the minLength.');
        throw Error(message);
    }

    // validate pattern
    if (config.hasOwnProperty('pattern') && !(config.pattern instanceof RegExp)) {
        const message = util.propertyErrorMessage('pattern', config.pattern, 'Must be a regular expression object.');
        throw Error(message);
    }

    // define properties
    Object.defineProperties(string, {

        maxLength: {
            /**
             * @property
             * @name TypedString#maxLength
             * @type {number}
             */
            value: Math.round(config.maxLength),
            writable: false
        },

        minLength: {
            /**
             * @property
             * @name TypedString#minLength
             * @type {number}
             */
            value: Math.round(config.minLength),
            writable: false
        },

        pattern: {
            /**
             * @property
             * @name TypedString#pattern
             * @type {RegExp}
             */
            value: config.pattern,
            writable: false
        }

    });

    return string;
}
function TypedString ( config ) { const string = this ; // validate min length if ( config . hasOwnProperty ( 'minLength' ) && ( ! util . isInteger ( config . minLength ) || config . minLength < 0 ) ) { const message = util . propertyErrorMessage ( 'minLength' , config . minLength , 'Must be an integer that is greater than or equal to zero.' ) ; throw Error ( message ) ; } const minLength = config . hasOwnProperty ( 'minLength' ) ? config . minLength : 0 ; // validate max length if ( config . hasOwnProperty ( 'maxLength' ) && ( ! util . isInteger ( config . maxLength ) || config . maxLength < minLength ) ) { const message = util . propertyErrorMessage ( 'maxLength' , config . maxLength , 'Must be an integer that is greater than or equal to the minLength.' ) ; throw Error ( message ) ; } // validate pattern if ( config . hasOwnProperty ( 'pattern' ) && ! ( config . pattern instanceof RegExp ) ) { const message = util . propertyErrorMessage ( 'pattern' , config . pattern , 'Must be a regular expression object.' ) ; throw Error ( message ) ; } // define properties Object . defineProperties ( string , { maxLength : { /**
             * @property
             * @name TypedString#maxLength
             * @type {number}
             */ value : Math . round ( config . maxLength ) , writable : false } , minLength : { /**
             * @property
             * @name TypedString#minLength
             * @type {number}
             */ value : Math . round ( config . minLength ) , writable : false } , pattern : { /**
             * @property
             * @name TypedString#pattern
             * @type {RegExp}
             */ value : config . pattern , writable : false } } ) ; return string ; }
Create a TypedString instance.
@param {object} config
@returns {TypedString}
@augments Typed
@constructor
Create a TypedString instance .