object-mixin
Version:
ES6 next big thing polyfilled before it gets real
2 lines • 1.25 kB
JavaScript
/*! WTFPL Style License */
/*jslint browser: true, forin: true, plusplus: true, indent: 4 */(function(e,t){"use strict";var n=e.prototype,r=n.__lookupGetter__,i=n.__lookupSetter__,s=n.__defineGetter__,o=n.__defineSetter__,u=n.hasOwnProperty,a=[],f=!0,l=function(e){try{return e&&e({},"_",{value:1})._&&e}catch(t){f=!1}}(e.defineProperty)||function(e,t,n){var r=n.get,i=n.set;r&&s&&s.call(e,t,r),i&&o&&o.call(e,t,i),!r&&!i&&(e[t]=n.value)},c=f&&e.getOwnPropertyNames||function(){var e=function(e){return e},t=[],n,r,i;for(n in{valueOf:n})t.push(n);return t.length||(i=t.push("constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf")-1,e=function(e,s){for(r=0;r<i;r++)n=t[r],u.call(s,n)&&e.push(n);return e}),function(t){var n=[],r;for(r in t)u.call(t,r)&&n.push(r);return e(n,t)}}(),h=f&&e.getOwnPropertyDescriptor||function(e,t){var n={enumerable:!0,configurable:!0},s=r&&r.call(e,t),o=i&&i.call(e,t);return s&&(n.get=s),o&&(n.set=o),!s&&!o&&(n.writable=!0,n.value=e[t]),n};if(e[t])return;l(e,t,{enumerable:!1,writable:!0,configurable:!0,value:function(e,t,n){var r,i,s,o;if(typeof t=="function")t.apply(e,n||a);else{s=c(t),i=s.length,r=0;while(r<i)o=s[r++],l(e,o,h(t,o))}return e}})})(Object,"mixin");