Skip to content

Commit e8e9fa2

Browse files
committed
optimize how we get html_all_collection type
1 parent 40e2e1f commit e8e9fa2

File tree

1 file changed

+11
-4
lines changed
  • packages/react-devtools-shared/src

1 file changed

+11
-4
lines changed

packages/react-devtools-shared/src/utils.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,6 @@ export function getDataType(data: Object): DataType {
406406
return 'html_element';
407407
}
408408

409-
if (Object.prototype.toString.call(data) === '[object HTMLAllCollection]') {
410-
return 'html_all_collection';
411-
}
412-
413409
const type = typeof data;
414410
switch (type) {
415411
case 'bigint':
@@ -445,12 +441,23 @@ export function getDataType(data: Object): DataType {
445441
return 'regexp';
446442
} else if (Object.prototype.toString.call(data) === '[object Date]') {
447443
return 'date';
444+
} else if (
445+
Object.prototype.toString.call(data) === '[object HTMLAllCollection]'
446+
) {
447+
return 'html_all_collection';
448448
}
449449
return 'object';
450450
case 'string':
451451
return 'string';
452452
case 'symbol':
453453
return 'symbol';
454+
case 'undefined':
455+
if (
456+
Object.prototype.toString.call(data) === '[object HTMLAllCollection]'
457+
) {
458+
return 'html_all_collection';
459+
}
460+
return 'undefined';
454461
default:
455462
return 'unknown';
456463
}

0 commit comments

Comments
 (0)