From 5366ba2b14300e891cfc066c5233f61b132ea412 Mon Sep 17 00:00:00 2001 From: Commander-lol <ljcapitanio@gmail.com> Date: Sat, 1 Nov 2014 16:04:28 +0000 Subject: [PATCH] Added simple JSON utilities --- js/tinyDOM.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/js/tinyDOM.js b/js/tinyDOM.js index 3a04f48..b9c571a 100644 --- a/js/tinyDOM.js +++ b/js/tinyDOM.js @@ -76,6 +76,23 @@ } } + tinyDOM.exists = function(obj){ + return obj !== null && typeof(obj) !== 'undefined'; + } + + tinyDOM.merge = function(json1, json2){ + if(!this.exists(json1) || !this.exists(json2)){ + return null; + } else { + for(var prop in json2) { + if(json2.hasOwnProperty(prop)){ + json1[prop] = json2[prop]; + } + } + return json1; + } + } + if(!window.μ){ window.μ = tinyDOM; } -- GitLab