updated utils.mergeObjects() wording & docs
Showing
2 changed files
with
10 additions
and
10 deletions
... | @@ -305,23 +305,23 @@ exports.isWebPage = isWebPage; | ... | @@ -305,23 +305,23 @@ exports.isWebPage = isWebPage; |
305 | /** | 305 | /** |
306 | * Object recursive merging utility. | 306 | * Object recursive merging utility. |
307 | * | 307 | * |
308 | * @param Object obj1 the destination object | 308 | * @param Object origin the origin object |
309 | * @param Object obj2 the source object | 309 | * @param Object add the object to merge data into origin |
310 | * @return Object | 310 | * @return Object |
311 | */ | 311 | */ |
312 | function mergeObjects(obj1, obj2) { | 312 | function mergeObjects(origin, add) { |
313 | for (var p in obj2) { | 313 | for (var p in add) { |
314 | try { | 314 | try { |
315 | if (obj2[p].constructor === Object) { | 315 | if (add[p].constructor === Object) { |
316 | obj1[p] = mergeObjects(obj1[p], obj2[p]); | 316 | origin[p] = mergeObjects(origin[p], add[p]); |
317 | } else { | 317 | } else { |
318 | obj1[p] = obj2[p]; | 318 | origin[p] = add[p]; |
319 | } | 319 | } |
320 | } catch(e) { | 320 | } catch(e) { |
321 | obj1[p] = obj2[p]; | 321 | origin[p] = add[p]; |
322 | } | 322 | } |
323 | } | 323 | } |
324 | return obj1; | 324 | return origin; |
325 | } | 325 | } |
326 | exports.mergeObjects = mergeObjects; | 326 | exports.mergeObjects = mergeObjects; |
327 | 327 | ... | ... |
-
Please register or sign in to post a comment