You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
610 B
23 lines
610 B
4 months ago
|
/**
|
||
|
* Merges the provided objects shallowly and removes
|
||
|
* all properties with an `undefined` value
|
||
|
*/
|
||
|
export function compact() {
|
||
|
var objects = [];
|
||
|
for (var _i = 0; _i < arguments.length; _i++) {
|
||
|
objects[_i] = arguments[_i];
|
||
|
}
|
||
|
var result = Object.create(null);
|
||
|
objects.forEach(function (obj) {
|
||
|
if (!obj)
|
||
|
return;
|
||
|
Object.keys(obj).forEach(function (key) {
|
||
|
var value = obj[key];
|
||
|
if (value !== void 0) {
|
||
|
result[key] = value;
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
return result;
|
||
|
}
|
||
|
//# sourceMappingURL=compact.js.map
|