lib/types/UnsignedLong.js
/**
     * The result of converting an IDL unsigned long value to an ECMAScript
     * value is a Number that represents the same numeric value as the
     * IDL unsigned long value. The Number value will be an integer in
     * the range [0, 4294967295].
     * @param {any} V - the value to convert to any.
     */
The result of converting an IDL unsigned long value to an ECMAScript
value is a Number that represents the same numeric value as the
IDL unsigned long value. The Number value will be an integer in
the range [0, 4294967295].
@param {any} V - the value to convert to any.
The result of converting an IDL unsigned long value to an ECMAScript value is a Number that represents the same numeric value as the IDL unsigned long value . The Number value will be an integer in the range [ 0 4294967295 ] . @param { any } V - the value to convert to any .
function converter(V, extendedAttr) {
        var x = Number(V);
        function esToUint32(x) {
            var number, posInt, n, int32bit;
            number = Number(x);
            if (isNaN(x) || number === 0 || number === Infinity || number === -Infinity) {
                return +0;
            }
            posInt = ((number > 0) ? 1 : -1) * Math.floor(Math.abs(number));
            n = Math.pow(2, 32);
            int32bit = ((posInt % n) + n) % n;
            return int32bit;
        }
        if (extendedAttr === 'EnforceRange') {
            if (isNaN(x) || x === +Infinity || x === -Infinity) {
                throw new TypeError();
            }
            x = ((x > 0) ? 1 : -1) * Math.floor(Math.abs(x));
            if (x < 0 || x > (Math.pow(2, 32) - 1)) {
                throw new TypeError();
            }
            return x;
        }
        if (extendedAttr === 'Clamp') {
             the
             with
            x = Math.min(Math.max(x, 0), Math.pow(2, 32) - 1);
            x = Math.abs(x - Math.round(x)) === 0.5 ? (((Math.round(x) % 2) === 0) ? Math.round(x) : Math.floor(x)) : Math.round(x);
             the same numeric value as x.
            return x;
        }
        x = esToUint32(x);
         the same numeric value as x.
        return x;
    }
function converter ( V , extendedAttr ) { var x = Number ( V ) ; function esToUint32 ( x ) { var number , posInt , n , int32bit ; number = Number ( x ) ; if ( isNaN ( x ) || number === 0 || number === Infinity || number === - Infinity ) { return + 0 ; } posInt = ( ( number > 0 ) ? 1 : - 1 ) * Math . floor ( Math . abs ( number ) ) ; n = Math . pow ( 2 , 32 ) ; int32bit = ( ( posInt % n ) + n ) % n ; return int32bit ; } if ( extendedAttr === 'EnforceRange' ) { if ( isNaN ( x ) || x === + Infinity || x === - Infinity ) { throw new TypeError ( ) ; } x = ( ( x > 0 ) ? 1 : - 1 ) * Math . floor ( Math . abs ( x ) ) ; if ( x < 0 || x > ( Math . pow ( 2 , 32 ) - 1 ) ) { throw new TypeError ( ) ; } return x ; } if ( extendedAttr === 'Clamp' ) { x = Math . min ( Math . max ( x , 0 ) , Math . pow ( 2 , 32 ) - 1 ) ; x = Math . abs ( x - Math . round ( x ) ) === 0.5 ? ( ( ( Math . round ( x ) % 2 ) === 0 ) ? Math . round ( x ) : Math . floor ( x ) ) : Math . round ( x ) ; return x ; } x = esToUint32 ( x ) ; return x ; }
The result of converting an IDL unsigned long value to an ECMAScript
 value is a Number that represents the same numeric value as the
 IDL unsigned long value.
The result of converting an IDL unsigned long value to an ECMAScript value is a Number that represents the same numeric value as the IDL unsigned long value .
//Initialize x to ToNumber(V). //@see http://people.mozilla.org/~jorendorff/es6-draft.html#sec-9.1.6 //Let number be the result of calling ToNumber on //the input argument. //If number is NaN, +0, −0, +∞, or −∞, return +0. //Let posInt be sign(number) * floor(abs(number)). //Let int32bit be posInt modulo 2^32; that is, a finite //integer value k of Number type with //positive sign and less than 2^32 in magnitude such //that the mathematical difference of //posInt and k is mathematically an integer multiple //of 2^32. //Return int32bit. //If the conversion to an IDL value is being performed due //to any of the following: //V is being assigned to an attribute annotated with //the [EnforceRange] extended attribute, //V is being passed as an operation argument annotated //with the [EnforceRange] extended attribute, or //V is being used as the value of dictionary member //annotated with the [EnforceRange] extended attribute, //then: //If x is NaN, +∞, or −∞, then throw a TypeError. //Set x to sign(x) * floor(abs(x)). //If x < 0 or x > 2^32 − 1, then throw a TypeError. //Return the IDL unsigned long value that represents //the same numeric value as x. //If x is not NaN and the conversion to an IDL value is being //performed due to any of the following: //V is being assigned to an attribute annotated with the //[Clamp] extended attribute, //V is being passed as an operation argument annotated with //the [Clamp] extended attribute, or //V is being used as the value of dictionary member //annotated with the [Clamp] extended attribute, //then: //Set x to min(max(x, 0), 2^32 − 1). //Round x to the nearest integer, choosing the even //integer if it lies halfway between two, and choosing //+0 rather than −0. //Return the IDL unsigned long value that represents the same numeric value as x. //Set x to ToUint32(x). //Return the IDL unsigned long value that represents the same numeric value as x.