ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
29 lines (28 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var ObjectUtils = /** @class */ (function () {
function ObjectUtils() {
}
ObjectUtils.assign = function (a, b) {
if (Object.assign != null)
return Object.assign(a, b);
return this.es5Assign(a, b);
};
ObjectUtils.es5Assign = function (a, b) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill
var to = Object(a);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource == null)
continue;
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey))
to[nextKey] = nextSource[nextKey];
}
}
return to;
};
return ObjectUtils;
}());
exports.ObjectUtils = ObjectUtils;