File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/react-devtools-shared/src Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ import {
44
44
ElementTypeMemo ,
45
45
} from 'react-devtools-shared/src/types' ;
46
46
import { localStorageGetItem , localStorageSetItem } from './storage' ;
47
- import { alphaSortEntries } from './devtools/views/utils' ;
48
47
import { meta } from './hydration' ;
49
48
50
49
import type { ComponentFilter , ElementType } from './types' ;
@@ -55,6 +54,16 @@ const cachedDisplayNames: WeakMap<Function, string> = new WeakMap();
55
54
// Try to reuse the already encoded strings.
56
55
let encodedStringCache = new LRU ( { max : 1000 } ) ;
57
56
57
+ export function alphaSortKeys ( a : string , b : string ) : number {
58
+ if ( a > b ) {
59
+ return 1 ;
60
+ } else if ( b > a ) {
61
+ return - 1 ;
62
+ } else {
63
+ return 0 ;
64
+ }
65
+ }
66
+
58
67
export function getDisplayName (
59
68
type : Function ,
60
69
fallbackName : string = 'Anonymous' ,
@@ -601,7 +610,7 @@ export function formatDataForPreview(
601
610
return data . toString ( ) ;
602
611
case 'object' :
603
612
if ( showFormattedValue ) {
604
- const keys = Object . keys ( data ) . sort ( alphaSortEntries ) ;
613
+ const keys = Object . keys ( data ) . sort ( alphaSortKeys ) ;
605
614
606
615
let formatted = '' ;
607
616
for ( let i = 0 ; i < keys . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments