lib/types/RegExp.js
/**
     * The result of converting an IDL RegExp value to an ECMAScript value is the
     * RegExp value that represents a reference to the same object that
     * the IDL RegExp represents.
     * IDL RegExp values are represented by ECMAScript RegExp objects.
     * @param {any} V - the value to convert.
     */
The result of converting an IDL RegExp value to an ECMAScript value is the
RegExp value that represents a reference to the same object that
the IDL RegExp represents.
The result of converting an IDL RegExp value to an ECMAScript value is the RegExp value that represents a reference to the same object that the IDL RegExp represents .
function converter(V) {
        var nativeBrand = Object.prototype.toString.apply(V),
            regex;
        function es5Type(x) {
            var type = (x === null) ? 'null' : typeof x;
            if (type === 'function') {
                type = 'Object';
            } else {
                type = type.charAt(0).toUpperCase() + type.slice(1);
            }
            return type;
        }
        if (es5Type(V) !== 'Object' || nativeBrand !== '[object RegExp]') {
            V = new RegExp(V);
        }
        return V;
    }
function converter ( V ) { var nativeBrand = Object . prototype . toString . apply ( V ) , regex ; function es5Type ( x ) { var type = ( x === null ) ? 'null' : typeof x ; if ( type === 'function' ) { type = 'Object' ; } else { type = type . charAt ( 0 ) . toUpperCase ( ) + type . slice ( 1 ) ; } return type ; } if ( es5Type ( V ) !== 'Object' || nativeBrand !== '[object RegExp]' ) { V = new RegExp ( V ) ; } return V ; }
The result of converting an IDL RegExp value to an ECMAScript value is the
 RegExp value that represents a reference to the same object that
 the IDL RegExp represents.
The result of converting an IDL RegExp value to an ECMAScript value is the RegExp value that represents a reference to the same object that the IDL RegExp represents .
//http://es5.github.com/#Type //correct for null being returned as "Object" //correct for function being an Object //uppercase first letter //If Type(V) is not Object, or the value of the internal [[NativeBrand]] //property of V is not “RegExp”, //then set V to be a newly created RegExp //object created as if by the expression new RegExp(V), //where RegExp is the standard built-in constructor with that name. //Return the IDL RegExp value that is a reference to the same object as V.