File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ import {
39
39
UNDEFINED ,
40
40
INFINITY ,
41
41
NAN ,
42
- isPlainObject
42
+ isPlainObject ,
43
+ sortByKey
43
44
} from ' src/util'
44
45
45
46
const rawTypeRE = / ^ \[ object (\w + )]$ /
@@ -125,11 +126,10 @@ export default {
125
126
value: item
126
127
}))
127
128
} else if (typeof value === ' object' ) {
128
- value = Object .keys (value).map (key => ({
129
+ value = sortByKey ( Object .keys (value).map (key => ({
129
130
key,
130
131
value: value[key]
131
- }))
132
- value = value .slice ().sort ((a , b ) => a .key > b .key )
132
+ })))
133
133
}
134
134
return value
135
135
},
Original file line number Diff line number Diff line change 33
33
import ScrollPane from ' components/ScrollPane.vue'
34
34
import ActionHeader from ' components/ActionHeader.vue'
35
35
import StateInspector from ' components/StateInspector.vue'
36
- import { searchDeepInObject } from ' src/util'
36
+ import { searchDeepInObject , sortByKey } from ' src/util'
37
37
import groupBy from ' lodash.groupby'
38
38
39
39
const isChrome = typeof chrome !== ' undefined' && chrome .devtools
@@ -57,7 +57,7 @@ export default {
57
57
return this .target .id != null
58
58
},
59
59
filteredState () {
60
- return groupBy (sort (this .target .state .filter (el => {
60
+ return groupBy (sortByKey (this .target .state .filter (el => {
61
61
return searchDeepInObject ({
62
62
[el .key ]: el .value
63
63
}, this .filter )
@@ -77,12 +77,4 @@ export default {
77
77
}
78
78
}
79
79
}
80
-
81
- function sort (state ) {
82
- return state && state .slice ().sort ((a , b ) => {
83
- if (a .key < b .key ) return - 1
84
- if (a .key > b .key ) return 1
85
- return 0
86
- })
87
- }
88
80
</script >
Original file line number Diff line number Diff line change @@ -155,3 +155,11 @@ function searchInArray (arr, searchTerm) {
155
155
}
156
156
return found
157
157
}
158
+
159
+ export function sortByKey ( state ) {
160
+ return state && state . slice ( ) . sort ( ( a , b ) => {
161
+ if ( a . key < b . key ) return - 1
162
+ if ( a . key > b . key ) return 1
163
+ return 0
164
+ } )
165
+ }
You can’t perform that action at this time.
0 commit comments