mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
Changes
This commit is contained in:
parent
3f63661b9a
commit
f4bb8af1c8
9
.prettierignore
Normal file
9
.prettierignore
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
*.log
|
||||||
|
.idea
|
||||||
|
lib
|
||||||
|
dist
|
||||||
|
umd
|
||||||
|
build
|
||||||
|
coverage
|
||||||
|
node_modules
|
||||||
|
__snapshots__
|
3
.prettierrc
Normal file
3
.prettierrc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
|
@ -1,23 +1,25 @@
|
||||||
function sortObject(obj, strict) {
|
function sortObject(obj, strict) {
|
||||||
if (obj instanceof Array) {
|
if (obj instanceof Array) {
|
||||||
let ary
|
let ary;
|
||||||
if (strict) {
|
if (strict) {
|
||||||
ary = obj.sort()
|
ary = obj.sort();
|
||||||
} else {
|
} else {
|
||||||
ary = obj
|
ary = obj;
|
||||||
}
|
}
|
||||||
return ary
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj && typeof obj === 'object') {
|
if (obj && typeof obj === 'object') {
|
||||||
const tObj = {}
|
const tObj = {};
|
||||||
Object.keys(obj).sort().forEach(key => tObj[key] = sortObject(obj[key]))
|
Object.keys(obj)
|
||||||
return tObj
|
.sort()
|
||||||
|
.forEach(key => (tObj[key] = sortObject(obj[key])));
|
||||||
|
return tObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function sortAndSerialize(obj) {
|
export default function sortAndSerialize(obj) {
|
||||||
return JSON.stringify(sortObject(obj, true), undefined, 2)
|
return JSON.stringify(sortObject(obj, true), undefined, 2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user