UNPKG

alt

Version:
36 lines (30 loc) 978 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.isMutableObject = isMutableObject; exports.eachObject = eachObject; exports.assign = assign; var isFunction = exports.isFunction = function isFunction(x) { return typeof x === 'function'; }; function isMutableObject(target) { var Ctor = target.constructor; return !!target && Object.prototype.toString.call(target) === '[object Object]' && isFunction(Ctor) && !Object.isFrozen(target) && (Ctor instanceof Ctor || target.type === 'AltStore'); } function eachObject(f, o) { o.forEach(function (from) { Object.keys(Object(from)).forEach(function (key) { f(key, from[key]); }); }); } function assign(target) { for (var _len = arguments.length, source = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { source[_key - 1] = arguments[_key]; } eachObject(function (key, value) { return target[key] = value; }, source); return target; }