DefinitelyTyped/types/object-merge/object-merge-tests.ts
2018-02-15 23:03:31 +01:00

48 lines
675 B
TypeScript

import objectMerge = require('object-merge');
const x = {
a : 'a',
b : 'b',
c : {
d : 'd',
e : 'e',
f : {
g : 'g'
}
}
};
const y = {
a : '`a',
b : '`b',
c : {
d : '`d'
}
};
const z = {
a : {
b : '``b'
},
fun : function foo() {
return 'foo';
},
aps : Array.prototype.slice
};
const out = objectMerge(x, y, z);
const a = {
a1 : {
a2 : {
a3 : {}
}
}
};
const b = {
b1 : {
b2 : {
b3 : {}
}
}
};
const opts = objectMerge.createOptions({depth : 2});
const res = objectMerge(opts, a, b);