polyfills.Object.defineProperty.min.js Maven / Gradle / Ivy
The newest version!
!function(e){var t=Object.prototype.hasOwnProperty("__defineGetter__"),r="A property cannot both have accessors and be writable or have a value";Object.defineProperty=function(n,o,i){if(e&&(n===window||n===document||n===Element.prototype||n instanceof Element))return e(n,o,i);if(null===n||!(n instanceof Object||"object"==typeof n))throw new TypeError("Object.defineProperty called on non-object");if(!(i instanceof Object))throw new TypeError("Property description must be an object");var f=String(o),a="value"in i||"writable"in i,c="get"in i&&typeof i.get,p="set"in i&&typeof i.set;if(c){if("function"!==c)throw new TypeError("Getter must be a function");if(!t)throw new TypeError("Getters & setters cannot be defined on this javascript engine");if(a)throw new TypeError(r);n.__defineGetter__(f,i.get)}else n[f]=i.value;if(p){if("function"!==p)throw new TypeError("Setter must be a function");if(!t)throw new TypeError("Getters & setters cannot be defined on this javascript engine");if(a)throw new TypeError(r);n.__defineSetter__(f,i.set)}return"value"in i&&(n[f]=i.value),n}}(Object.defineProperty);