Created
February 7, 2014 12:26
-
-
Save Silom/8861774 to your computer and use it in GitHub Desktop.
This dist shows you how to merge endless json objects in JavaScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function merge(json) { | |
var sources = [].slice.call(arguments, 1); | |
sources.forEach(function (source) { | |
for (var property in source) { | |
json[property] = source[property]; | |
} | |
}); | |
return json; | |
} | |
// merge(json1, json2, json3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment