UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 1.06 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import e from"./../assert/has-define-property-support.js";import r from"./../assert/has-property.js";import t from"./../assert/is-object.js";var o=Object.defineProperty,a=r,_=t,p=Object.prototype,i=p.__defineGetter__,n=p.__defineSetter__,s=p.__lookupGetter__,l=p.__lookupSetter__;function u(e,r,t){var o,u,c,f;if(!_(e))throw new TypeError("invalid argument. First argument must be an object. Value: `"+e+"`.");if(!_(t))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+t+"`.");if((u=a(t,"value"))&&(s.call(e,r)||l.call(e,r)?(o=e.__proto__,e.__proto__=p,delete e[r],e[r]=t.value,e.__proto__=o):e[r]=t.value),c=a(t,"get"),f=a(t,"set"),u&&(c||f))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return c&&i&&i.call(e,r,t.get),f&&n&&n.call(e,r,t.set),e}var c,f=e,m=o,d=u,v=c=f()?m:d;export default v; //# sourceMappingURL=define-property.js.map