@@ -48,6 +48,7 @@ import {
48
48
} from 'react-devtools-shared/src/types' ;
49
49
import { localStorageGetItem , localStorageSetItem } from './storage' ;
50
50
import { meta } from './hydration' ;
51
+ import isArray from './isArray' ;
51
52
52
53
import type { ComponentFilter , ElementType } from './types' ;
53
54
import type { LRUCache } from 'react-devtools-shared/src/types' ;
@@ -475,7 +476,7 @@ export function deletePathInObject(
475
476
if ( object != null ) {
476
477
const parent = getInObject ( object , path . slice ( 0 , length - 1 ) ) ;
477
478
if ( parent ) {
478
- if ( Array . isArray ( parent ) ) {
479
+ if ( isArray ( parent ) ) {
479
480
parent . splice ( ( ( last : any ) : number ) , 1 ) ;
480
481
} else {
481
482
delete parent [ last ] ;
@@ -496,7 +497,7 @@ export function renamePathInObject(
496
497
const lastOld = oldPath [ length - 1 ] ;
497
498
const lastNew = newPath [ length - 1 ] ;
498
499
parent [ lastNew ] = parent [ lastOld ] ;
499
- if ( Array . isArray ( parent ) ) {
500
+ if ( isArray ( parent ) ) {
500
501
parent . splice ( ( ( lastOld : any ) : number ) , 1 ) ;
501
502
} else {
502
503
delete parent [ lastOld ] ;
@@ -580,7 +581,7 @@ export function getDataType(data: Object): DataType {
580
581
return 'number ';
581
582
}
582
583
case 'object ':
583
- if ( Array . isArray ( data ) ) {
584
+ if ( isArray ( data ) ) {
584
585
return 'array ';
585
586
} else if ( ArrayBuffer . isView ( data ) ) {
586
587
return hasOwnProperty . call ( data . constructor , 'BYTES_PER_ELEMENT' )
@@ -799,7 +800,7 @@ export function formatDataForPreview(
799
800
// To mimic their behavior, detect if we've been given an entries tuple.
800
801
// Map(2) {"abc" => 123, "def" => 123}
801
802
// Set(2) {"abc", 123}
802
- if (Array. isArray(entryOrEntries)) {
803
+ if (isArray(entryOrEntries)) {
803
804
const key = formatDataForPreview(entryOrEntries[0], true);
804
805
const value = formatDataForPreview(entryOrEntries[1], false);
805
806
formatted += ` $ { key } => ${value } `;
0 commit comments