From 2808975c75825eb163f2669dff7214b8660b5b05 Mon Sep 17 00:00:00 2001 From: STAFYNIAK Sacha Date: Mon, 17 Sep 2018 05:44:37 +0200 Subject: [PATCH 1/2] add support for 'null' values in json objects --- examples/app.js | 5 +++-- json-box.vue | 5 ++++- types/json-null.vue | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 types/json-null.vue diff --git a/examples/app.js b/examples/app.js index cf90e20..cdbfcec 100644 --- a/examples/app.js +++ b/examples/app.js @@ -15,10 +15,11 @@ new Vue({ b: 'a', a: 'hello word', asd2: 1, - asd: false + asd: false, + foo: null } } } }, components: {JsonViewer} -}) \ No newline at end of file +}) diff --git a/json-box.vue b/json-box.vue index 9857f48..7fa6ad3 100644 --- a/json-box.vue +++ b/json-box.vue @@ -11,6 +11,7 @@ + + From 614a37caf269f29be76d151d6eec0e10035c856a Mon Sep 17 00:00:00 2001 From: STAFYNIAK Sacha Date: Mon, 17 Sep 2018 05:58:30 +0200 Subject: [PATCH 2/2] add support for 'undefined' values in json objects --- json-box.vue | 2 +- types/json-null.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/json-box.vue b/json-box.vue index 7fa6ad3..7a95910 100644 --- a/json-box.vue +++ b/json-box.vue @@ -35,7 +35,7 @@ export default { }, computed: { valueType() { - if (this.value === null) { + if (this.value === null || this.value === undefined) { return 'Null'; } else if (Array.isArray(this.value)) { return 'Array'; diff --git a/types/json-null.vue b/types/json-null.vue index 7e5768f..b424821 100644 --- a/types/json-null.vue +++ b/types/json-null.vue @@ -1,5 +1,5 @@