fix a bug in console.log with non-string args (#24546)

This commit is contained in:
Mengdi "Monday" Chen
2022-05-12 10:29:36 -04:00
committed by GitHub
parent 34da5aa69b
commit 852f10b5cf
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -181,8 +181,9 @@ export function formatWithStyles(
inputArgs === undefined ||
inputArgs === null ||
inputArgs.length === 0 ||
typeof inputArgs[0] !== 'string' ||
// Matches any of %c but not %%c
(typeof inputArgs[0] === 'string' && inputArgs[0].match(/([^%]|^)(%c)/g)) ||
inputArgs[0].match(/([^%]|^)(%c)/g) ||
style === undefined
) {
return inputArgs;
+2 -2
View File
@@ -180,9 +180,9 @@ export function installHook(target: any): DevToolsHook | null {
inputArgs === undefined ||
inputArgs === null ||
inputArgs.length === 0 ||
typeof inputArgs[0] !== 'string' ||
// Matches any of %c but not %%c
(typeof inputArgs[0] === 'string' &&
inputArgs[0].match(/([^%]|^)(%c)/g)) ||
inputArgs[0].match(/([^%]|^)(%c)/g) ||
style === undefined
) {
return inputArgs;