UNPKG

fexios

Version:

Fetch based HTTP client with similar API to axios for browser and Node.js

43 lines (39 loc) 1.37 kB
import { c as clone, i as isPlainObject } from '../shared/fexios.DtQgiOCE.mjs'; const CallableInstanceImpl = function(property) { const proto = this.constructor.prototype; const func = Reflect.get(proto, property, proto); function apply(...args) { return Reflect.apply(func, apply, args); } Reflect.setPrototypeOf(apply, proto); for (const key of Reflect.ownKeys(func)) { const desc = Reflect.getOwnPropertyDescriptor(func, key); if (desc) Reflect.defineProperty(apply, key, desc); } return apply; }; CallableInstanceImpl.prototype = Object.create(Function.prototype); const CallableInstance = CallableInstanceImpl; function deepMerge(obj, ...incomes) { const result = clone(obj || {}); for (const inc of incomes) { if (inc == null) continue; for (const key of Reflect.ownKeys(inc)) { const nextVal = inc[key]; if (typeof nextVal === "undefined") continue; if (nextVal === null) { delete result[key]; continue; } const prevVal = result[key]; if (isPlainObject(prevVal) && isPlainObject(nextVal)) { result[key] = deepMerge(prevVal, nextVal); } else { result[key] = clone(nextVal); } } } return result; } export { CallableInstance, isPlainObject as checkIsPlainObject, clone, deepMerge, isPlainObject }; //# sourceMappingURL=index.mjs.map