2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-20 20:00:37 +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 () { ordered () {
const ordered = {}; const ordered = {};
if (this.sortKeys) { if (this.sortKeys) {
Object.keys(this.jsonValue).sort().forEach(function(key) { Object.keys(this.jsonValue).sort().forEach(key => {
ordered[key] = this.jsonValue[key]; ordered[key] = this.jsonValue[key];
}); });
} else {
ordered = this.jsonValue
} }
return ordered; return ordered;
} }