svghmi/sprintf.js
branchpython3
changeset 3854 d29d67e86532
parent 3837 efe0b5b21842
equal deleted inserted replaced
3853:e1cfb03e6582 3854:d29d67e86532
    57 
    57 
    58                 if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
    58                 if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
    59                     arg = arg()
    59                     arg = arg()
    60                 }
    60                 }
    61 
    61 
    62                 if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {
    62                 if (re.numeric_arg.test(ph.type)){
    63                     throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
    63                     let argtype = typeof arg;
       
    64                     if ( argtype !== 'bigint') {
       
    65                         if ( argtype !== 'number' && isNaN(arg) ) {
       
    66                             throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
       
    67                         }
       
    68                     }
    64                 }
    69                 }
    65 
    70 
    66                 if (re.number.test(ph.type)) {
    71                 if (re.number.test(ph.type)) {
    67                     is_positive = arg >= 0
    72                     is_positive = arg >= 0
    68                 }
    73                 }