@@ -287,13 +287,16 @@ function quote(s) {
287287 return $replace . call ( String ( s ) , / " / g, '"' ) ;
288288}
289289
290- function isArray ( obj ) { return toStr ( obj ) === '[object Array]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
291- function isDate ( obj ) { return toStr ( obj ) === '[object Date]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
292- function isRegExp ( obj ) { return toStr ( obj ) === '[object RegExp]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
293- function isError ( obj ) { return toStr ( obj ) === '[object Error]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
294- function isString ( obj ) { return toStr ( obj ) === '[object String]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
295- function isNumber ( obj ) { return toStr ( obj ) === '[object Number]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
296- function isBoolean ( obj ) { return toStr ( obj ) === '[object Boolean]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
290+ function canTrustToString ( obj ) {
291+ return ! toStringTag || ! ( typeof obj === 'object' && ( toStringTag in obj || typeof obj [ toStringTag ] !== 'undefined' ) ) ;
292+ }
293+ function isArray ( obj ) { return toStr ( obj ) === '[object Array]' && canTrustToString ( obj ) ; }
294+ function isDate ( obj ) { return toStr ( obj ) === '[object Date]' && canTrustToString ( obj ) ; }
295+ function isRegExp ( obj ) { return toStr ( obj ) === '[object RegExp]' && canTrustToString ( obj ) ; }
296+ function isError ( obj ) { return toStr ( obj ) === '[object Error]' && canTrustToString ( obj ) ; }
297+ function isString ( obj ) { return toStr ( obj ) === '[object String]' && canTrustToString ( obj ) ; }
298+ function isNumber ( obj ) { return toStr ( obj ) === '[object Number]' && canTrustToString ( obj ) ; }
299+ function isBoolean ( obj ) { return toStr ( obj ) === '[object Boolean]' && canTrustToString ( obj ) ; }
297300
298301// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
299302function isSymbol ( obj ) {
0 commit comments