lib/collection/variable.js
function (typeName, _noCast) {
        !_.isNil(typeName) && (typeName = typeName.toString().toLowerCase()); // sanitize
        if (!Variable.types[typeName]) {
            return this.type || ANY; // @todo: throw new Error('Invalid variable type.');
        }

        // set type if it is valid
        this.type = typeName;

        // 1. get the current value
        // 2. set the new type if it is valid and cast the stored value
        // 3. then set the interstitial value
        var interstitialCastValue;

        // do not touch value functions
        if (!(_noCast || _.isFunction(this.value))) {
            interstitialCastValue = this.get();
            this.set(interstitialCastValue);
            interstitialCastValue = null; // just a precaution
        }

        return this.type;
    }
function (typeName, _noCast) {
        !_.isNil(typeName) && (typeName = typeName.toString().toLowerCase()); // sanitize
        if (!Variable.types[typeName]) {
            return this.type || ANY; // @todo: throw new Error('Invalid variable type.');
        }

        // set type if it is valid
        this.type = typeName;

        // 1. get the current value
        // 2. set the new type if it is valid and cast the stored value
        // 3. then set the interstitial value
        var interstitialCastValue;

        // do not touch value functions
        if (!(_noCast || _.isFunction(this.value))) {
            interstitialCastValue = this.get();
            this.set(interstitialCastValue);
            interstitialCastValue = null; // just a precaution
        }

        return this.type;
    }
function ( typeName , _noCast ) { ! _ . isNil ( typeName ) && ( typeName = typeName . toString ( ) . toLowerCase ( ) ) ; // sanitize if ( ! Variable . types [ typeName ] ) { return this . type || ANY ; // @todo: throw new Error('Invalid variable type.'); } // set type if it is valid this . type = typeName ; // 1. get the current value // 2. set the new type if it is valid and cast the stored value // 3. then set the interstitial value var interstitialCastValue ; // do not touch value functions if ( ! ( _noCast || _ . isFunction ( this . value ) ) ) { interstitialCastValue = this . get ( ) ; this . set ( interstitialCastValue ) ; interstitialCastValue = null ; // just a precaution } return this . type ; }
Sets or gets the type of the value.

@param {String} typeName
@param {Boolean} _noCast
@returns {String} - returns the current type of the variable from the list of {@link Variable.types}
Sets or gets the type of the value .