Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
323a5c27
...
323a5c27b8e086f9a842257872472c1a3fb1b0a9
authored
2012-06-03 16:00:30 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updated utils.mergeObjects() wording & docs
1 parent
4e0b7878
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
docs
modules/utils.js
docs
@
c4948529
Subproject commit
8f3d23e52d3552564310990b79d4a6b4a3e1d06f
Subproject commit
c49485298b9ed585d7fec76305d96f2689ab8bd4
...
...
modules/utils.js
View file @
323a5c2
...
...
@@ -305,23 +305,23 @@ exports.isWebPage = isWebPage;
/**
* Object recursive merging utility.
*
* @param Object o
bj1 the destinatio
n object
* @param Object
obj2 the source object
* @param Object o
rigin the origi
n object
* @param Object
add the object to merge data into origin
* @return Object
*/
function
mergeObjects
(
o
bj1
,
obj2
)
{
for
(
var
p
in
obj2
)
{
function
mergeObjects
(
o
rigin
,
add
)
{
for
(
var
p
in
add
)
{
try
{
if
(
obj2
[
p
].
constructor
===
Object
)
{
o
bj1
[
p
]
=
mergeObjects
(
obj1
[
p
],
obj2
[
p
]);
if
(
add
[
p
].
constructor
===
Object
)
{
o
rigin
[
p
]
=
mergeObjects
(
origin
[
p
],
add
[
p
]);
}
else
{
o
bj1
[
p
]
=
obj2
[
p
];
o
rigin
[
p
]
=
add
[
p
];
}
}
catch
(
e
)
{
o
bj1
[
p
]
=
obj2
[
p
];
o
rigin
[
p
]
=
add
[
p
];
}
}
return
o
bj1
;
return
o
rigin
;
}
exports
.
mergeObjects
=
mergeObjects
;
...
...
Please
register
or
sign in
to post a comment