src/helpers.js
function assertLong(value, unsigned) {
    if (typeof value === 'number') {
        return Long.fromNumber(value, unsigned);
    } else if (typeof value === 'string') {
        return Long.fromString(value, unsigned);
    } else if (value && value instanceof Long) {
        if (typeof unsigned !== 'undefined') {
            if (unsigned && !value.unsigned) return value.toUnsigned();
            if (!unsigned && value.unsigned) return value.toSigned();
        }
        return value;
    } else
        throw TypeError("Illegal value: "+value+" (not an integer or Long)");
}
function assertLong(value, unsigned) {
    if (typeof value === 'number') {
        return Long.fromNumber(value, unsigned);
    } else if (typeof value === 'string') {
        return Long.fromString(value, unsigned);
    } else if (value && value instanceof Long) {
        if (typeof unsigned !== 'undefined') {
            if (unsigned && !value.unsigned) return value.toUnsigned();
            if (!unsigned && value.unsigned) return value.toSigned();
        }
        return value;
    } else
        throw TypeError("Illegal value: "+value+" (not an integer or Long)");
}
function assertLong ( value , unsigned ) { if ( typeof value === 'number' ) { return Long . fromNumber ( value , unsigned ) ; } else if ( typeof value === 'string' ) { return Long . fromString ( value , unsigned ) ; } else if ( value && value instanceof Long ) { if ( typeof unsigned !== 'undefined' ) { if ( unsigned && ! value . unsigned ) return value . toUnsigned ( ) ; if ( ! unsigned && value . unsigned ) return value . toSigned ( ) ; } return value ; } else throw TypeError ( "Illegal value: " + value + " (not an integer or Long)" ) ; }
Asserts that a value is an integer or Long.
@param {number|!Long} value Value to assert
@param {boolean=} unsigned Whether explicitly unsigned
@returns {number|!Long} Type-safe value
@throws {TypeError} If `value` is not an integer or Long
@inner
Asserts that a value is an integer or Long .