UNPKG

ee-class

Version:

Fast prototype based javascript classes

3 lines (2 loc) 3.41 kB
!function(e,t){"use strict";"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t():("object"!=typeof e.ee&&(e.ee={}),e.ee.Class=t())}(this,function(){"use strict";var e,t,r;return e=function(e,r,n,o){r["super"]=function(){var t,n,o;if(r.___super){for(t=[],n=0,o=arguments.length;o>n;n++)t.push(arguments[n]);return r.___super.apply(this,t)}throw new Error("The method «"+e+"» has no super «"+e+"» method on any protoype!")},r.local||Object.defineProperty(r,"local",{value:o}),n&&n.prototype&&t(e,r,n.prototype,o)},t=function(e,r,n,o){r.local||Object.defineProperty(r,"local",{value:o}),n&&(Object.hasOwnProperty.call(n,e)?Object.defineProperty(r,"___super",{value:n[e]}):n.___isEeClass||"init"!==e||"object"!=typeof n||"function"!=typeof n.constructor?t(e,r,"object"==typeof n?Object.getPrototypeOf(n):null,o):Object.defineProperty(r,"___super",{value:n.constructor}))},r=function(t){var n,o={};return this instanceof r?(t.inherits&&t.inherits.___properties&&(o=t.inherits.___properties),Object.keys(t).forEach(function(r){var n=t[r];"inherits"!==r&&("function"==typeof n?(o[r]={value:n,enumerable:"_"!==r[0]},o[r].value.displayName||Object.defineProperty(o[r].value,"displayName",{value:r}),e(r,n,t.inherits,t)):"object"==typeof n&&"[object Object]"===Object.prototype.toString.call(n)?Object.hasOwnProperty.call(n,"get")||Object.hasOwnProperty.call(n,"value")||Object.hasOwnProperty.call(n,"set")?Object.keys(n).some(function(e){return-1===["get","set","value","enumerable","writable","configurable"].indexOf(e)})?o[r]=o[r]={value:n,enumerable:!0,writable:!0}:(o[r]=n,"function"==typeof n.value&&(e(r,n.value,t.inherits,t),n.value.displayName||Object.defineProperty(n.value,"displayName",{value:r}))):o[r]=o[r]={value:n,enumerable:!0,writable:!0}:o[r]={value:n,enumerable:!0,writable:!0})}),"function"==typeof Symbol&&Symbol.iterator in t&&(o[Symbol.iterator]={value:t[Symbol.iterator],writable:!0}),n=function(){var e,r,o,i=[];if(!(this instanceof n))throw new Error("the class constructor was called without the «new» keyword!");for(r=0,o=arguments.length;o>r;r++)i.push(arguments[r]);return this.init?e=this.init.apply(this,i):"function"==typeof t.inherits&&t.inherits.apply(this,i),"undefined"!=typeof e?e:void 0},n.prototype=Object.create(t.inherits?t.inherits.prototype?t.inherits.prototype:t.inherits:{},o),Object.defineProperty(n.prototype,"___isEeClass",{value:!0}),n):Object.create(r,{value:{value:t,enumerable:!0}})},r.Enumerable=function(){return Object.defineProperty(this,"enumerable",{value:!0,enumerable:!0}),this},r.Configurable=function(){return Object.defineProperty(this,"configurable",{value:!0,enumerable:!0}),this},r.Writable=function(){return Object.defineProperty(this,"writable",{value:!0,enumerable:!0}),this},r.proto=function(e){return"object"==typeof e?Object.getPrototypeOf(e):void 0},r.keys=function(e){var t=[];for(var r in e)t.push(r);return t},r.define=function(e,t,r){Object.defineProperty(e,t,r)},r.implement=function(e,t){return r.keys(e).forEach(function(r){t[r]=e[r]}),t},r.inspect=function(e,t){return t=t||{},Object.getOwnPropertyNames(e).sort().forEach(function(r){"function"==typeof e[r]?t[r]=function(){}:"___isEeClass"!==r&&(t[r]=e[r])}),Object.getPrototypeOf(e)&&(t["super"]={},r.inspect(Object.getPrototypeOf(e),t["super"])),t},r}); //# sourceMappingURL=maps/ee-class.min.js.map