Skip to content

Commit

Permalink
Add mergeObjects function
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelblend committed Feb 19, 2014
1 parent a0654d0 commit 2aede27
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,21 @@ function uuid() {
});
}

function mergeObjects(defaultObj, specificObj) {
var obj = JSON.parse(JSON.stringify(defaultObj)),
cleanSpecificObj = JSON.parse(JSON.stringify(specificObj));

Object.keys(cleanSpecificObj).forEach(function(key) {
obj[key] = cleanSpecificObj[key];
});

return obj;
}

module.exports = {
logger: sharedLogger,
promise: Q,
failedPromiseHandler: failedPromiseHandler,
uuid: uuid
uuid: uuid,
mergeObjects: mergeObjects
}

0 comments on commit 2aede27

Please sign in to comment.