added utility function to AddOrUpdate a field on object
This commit is contained in:
parent
249a00dd7e
commit
b1cae8da4f
|
|
@ -11,6 +11,20 @@ var scripts = document.getElementsByTagName('script'),
|
||||||
tarteaucitronProLoadServices,
|
tarteaucitronProLoadServices,
|
||||||
tarteaucitronNoAdBlocker = false;
|
tarteaucitronNoAdBlocker = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Utility function to Add or update the fields of obj1 with the ones in obj2
|
||||||
|
*/
|
||||||
|
function AddOrUpdate(obj1, obj2){
|
||||||
|
for(key in obj2){
|
||||||
|
if(obj2[key] instanceof Object){
|
||||||
|
obj1[key] = AddOrUpdate(obj1[key], obj2[key]);
|
||||||
|
}else{
|
||||||
|
obj1[key] = obj2[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj1;
|
||||||
|
}
|
||||||
|
|
||||||
var tarteaucitron = {
|
var tarteaucitron = {
|
||||||
"version": 323,
|
"version": 323,
|
||||||
"cdn": cdn,
|
"cdn": cdn,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue