2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-08 17:22:32 +03:00

add an option to enable key sorting before display

This commit is contained in:
STAFYNIAK Sacha
2018-09-17 07:37:09 +02:00
parent 02c69c472c
commit eee0eb5d8a
+3 -1
View File
@@ -24,9 +24,11 @@ export default {
ordered () {
const ordered = {};
if (this.sortKeys) {
Object.keys(this.jsonValue).sort().forEach(function(key) {
Object.keys(this.jsonValue).sort().forEach(key => {
ordered[key] = this.jsonValue[key];
});
} else {
ordered = this.jsonValue
}
return ordered;
}