svghmi/sprintf.js
changeset 3837 efe0b5b21842
parent 3486 0d5bb9038e5b
equal deleted inserted replaced
3744:65969628e920 3837:efe0b5b21842
    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                 }