UNPKG

ooobject

Version:

object generation helper via composition, OLOO style

132 lines 18.8 kB
!function(t,n){for(var r in n)t[r]=n[r]}(exports,function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([/*!**********************!*\ !*** ./src/index.js ***! \**********************/ function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var o=r(/*! ./Base */11),i=e(o);r(/*! core-js/fn/array/from */20),r(/*! core-js/fn/object/assign */21),r(/*! core-js/fn/reflect/enumerate */22);var u=r(/*! ./helpers */12),c={create:function(t,n){t.className||(t.className="");var t=Object.assign(i["default"](),t),r=[],e=!0,o=[];if(n&&(o=n.components||[],n.init===!1&&(e=!1),r=n.readonly||[]),t.__inner={},t.__inner.readonly=r,o.length>0)for(var c=0;c<o.length;c++){var a=o[c]({},!1);n.readonly=n.readonly.concat(a.__inner.readonly),t=Object.assign(a,t)}return e?(r&&r.length>0&&u.setReadOnly.call(t.__inner,"readonly"),t.init(n)):t}};n["default"]=c,t.exports=n["default"]},/*!************************************!*\ !*** ./~/core-js/modules/$.wks.js ***! \************************************/ function(t,n,r){var e=r(/*! ./$.shared */34)("wks"),o=r(/*! ./$.global */3).Symbol;t.exports=function(t){/*! ./$.uid */ return e[t]||(e[t]=o&&o[t]||(o||r(19))("Symbol."+t))}},/*!*************************************!*\ !*** ./~/core-js/modules/$.core.js ***! \*************************************/ function(t,n){var r={};t.exports=r,"number"==typeof __e&&(__e=r)},/*!***************************************!*\ !*** ./~/core-js/modules/$.global.js ***! \***************************************/ function(t,n){var r="undefined"!=typeof self&&self.Math==Math?self:Function("return this")();t.exports=r,"number"==typeof __g&&(__g=r)},/*!*************************************!*\ !*** ./~/core-js/modules/$.hide.js ***! \*************************************/ function(t,n,r){var e=r(/*! ./$ */5),o=r(/*! ./$.property-desc */16);t.exports=r(/*! ./$.support-desc */36)?function(t,n,r){return e.setDesc(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},/*!********************************!*\ !*** ./~/core-js/modules/$.js ***! \********************************/ function(t,n){var r=Object;t.exports={create:r.create,getProto:r.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:r.getOwnPropertyDescriptor,setDesc:r.defineProperty,setDescs:r.defineProperties,getKeys:r.keys,getNames:r.getOwnPropertyNames,getSymbols:r.getOwnPropertySymbols,ES5Object:r,each:[].forEach}},/*!************************************!*\ !*** ./~/core-js/modules/$.def.js ***! \************************************/ function(t,n,r){function e(t,n){return function(){return t.apply(n,arguments)}}function o(t,n,r){var l,p,h,v,y=t&o.G,d=t&o.P,g=y?i:t&o.S?i[n]||(i[n]={}):(i[n]||{})[s],m=y?u:u[n]||(u[n]={});y&&(r=n);for(l in r)p=!(t&o.F)&&g&&l in g,h=(p?g:r)[l],v=t&o.B&&p?e(h,i):d&&f(h)?e(Function.call,h):h,g&&!p&&a(g,l,h),m[l]!=h&&c(m,l,v),d&&((m[s]||(m[s]={}))[l]=h)}var i=r(/*! ./$.global */3),u=r(/*! ./$.core */2),c=r(/*! ./$.hide */4),a=r(/*! ./$.redef */17),f=r(/*! ./$.is-function */14),s="prototype";i.core=u,o.F=1,o.G=2,o.S=4,o.P=8,o.B=16,o.W=32,t.exports=o},/*!************************************!*\ !*** ./~/core-js/modules/$.cof.js ***! \************************************/ function(t,n,r){function e(t){return c.call(t).slice(8,-1)}var o=r(/*! ./$.has */9),i=r(/*! ./$.hide */4),u=r(/*! ./$.wks */1)("toStringTag"),c={}.toString;e.classof=function(t){var n,r;return void 0==t?void 0===t?"Undefined":"Null":"string"==typeof(r=(n=Object(t))[u])?r:e(n)},e.set=function(t,n,r){t&&!o(t=r?t:t.prototype,u)&&i(t,u,n)},t.exports=e},/*!****************************************!*\ !*** ./~/core-js/modules/$.defined.js ***! \****************************************/ function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},/*!************************************!*\ !*** ./~/core-js/modules/$.has.js ***! \************************************/ function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},/*!******************************************!*\ !*** ./~/core-js/modules/$.iterators.js ***! \******************************************/ function(t,n){t.exports={}},/*!*********************!*\ !*** ./src/Base.js ***! \*********************/ function(t,n,r){"use strict";function e(){var t={className:"Base",set:function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return o.set.call.apply(o.set,[this].concat(n))},get:function(t){return o.get.call(this,t)},init:function(t){return o.init.call(this,t||{})},toString:function(){return o.toString.call(this)}};return Object.create(t)}Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=e;var o=r(/*! ./helpers */12);t.exports=n["default"]},/*!************************!*\ !*** ./src/helpers.js ***! \************************/ function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{"default":t}}function o(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)}function i(t){var n=Object.getOwnPropertyDescriptor(this,t);n&&(n.writable=!1,n.configurable=!1),Object.defineProperty(this,t,n)}function u(t){var n=Object.getOwnPropertyDescriptor(this,t);n&&(n.enumerable=!1),Object.defineProperty(this,t,n)}function c(t){var n=Object.getOwnPropertyDescriptor(this,t);n&&(n.enumerable=!1,n.writable=!1,n.configurable=!1),Object.defineProperty(this,t,n)}function a(t){var n=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,r=this[t],e=r.toString().replace(n,""),o=[];return o=(e||[]).slice(e.indexOf("(")+1,e.indexOf(")")).match(/([^\s,]+)/g),o=o?o.map(function(n){if(0===n.indexOf("_")){var r=n.substr(1,n.length);r===t&&(n=r)}return n}):[]}function f(){return[].concat(o(Reflect.enumerate(this)))}function s(t){var n=this[t];return"string"==typeof n&&(n="'"+n+"'"),t+": "+n+" <"+typeof n+">"}function l(t){var n=a.call(this,t).join(", ");return t+"("+n+")"}function p(t){var n=f.call(this);if(-1===n.indexOf(t))throw new Error("property '"+t+"' not found on "+this.className)}function h(t){if("function"==typeof this[t])throw new Error("cannot set a function: "+t+"()")}function v(t,n){var r=typeof this[t];try{"number"===r?this[t]=parseInt(n):"boolean"===r?(0===n||"0"===n?n=!1:(1===n||"1"===n)&&(n=!0),this[t]=JSON.parse(n)):"string"===r?this[t]=n+"":this[t]=n}catch(e){}}function y(t){return p.call(this,t),this[t]}function d(t){return i.call(this,t)}function g(){if("object"==typeof arguments[0]){var t=arguments[0];for(var n in t)g.call(this,n,t[n])}else{var n=arguments[0],r=arguments[1];p.call(this,n),h.call(this,n),v.call(this,n,r)}return this}function m(t){for(var n=t.readonly||[],r=t.data||{},e=f.call(this),o=0;o<e.length;o++){var a=e[o];0===a.indexOf("_")?-1!==n.indexOf(a)?c.call(this,a):u.call(this,a):("className"===a||-1!==n.indexOf(a))&&i.call(this,a)}return r?(g.call(this,r),this):this}function x(){var t=this,n=f.call(this),r=f.call(_["default"]()),e=n.filter(function(n){return"function"!=typeof t[n]&&-1===r.indexOf(n)}).map(function(n){return s.call(t,n)}),o=n.filter(function(n){return"function"==typeof t[n]&&-1===r.indexOf(n)}).map(function(n){return l.call(t,n)}),i="[Object "+this.className+"]";return i+="\n\n"+e.join("\n"),i+="\n\n"+o.join("\n")}Object.defineProperty(n,"__esModule",{value:!0});var b=r(/*! ./Base */11),_=e(b);n["default"]={get:y,set:g,init:m,toString:x,setReadOnly:d},t.exports=n["default"]},/*!******************************************!*\ !*** ./~/core-js/modules/$.an-object.js ***! \******************************************/ function(t,n,r){var e=r(/*! ./$.is-object */28);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},/*!********************************************!*\ !*** ./~/core-js/modules/$.is-function.js ***! \********************************************/ function(t,n){t.exports=function(t){return"function"==typeof t}},/*!********************************************!*\ !*** ./~/core-js/modules/$.iter-create.js ***! \********************************************/ function(t,n,r){"use strict";var e=r(/*! ./$ */5),o={};r(/*! ./$.hide */4)(o,r(/*! ./$.wks */1)("iterator"),function(){return this}),t.exports=function(t,n,i){t.prototype=e.create(o,{next:r(/*! ./$.property-desc */16)(1,i)}),r(/*! ./$.cof */7).set(t,n+" Iterator")}},/*!**********************************************!*\ !*** ./~/core-js/modules/$.property-desc.js ***! \**********************************************/ function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},/*!**************************************!*\ !*** ./~/core-js/modules/$.redef.js ***! \**************************************/ function(t,n,r){function e(t,n,r,e){if(c(r)){var i=t[n];u(r,f,i?String(i):a.replace(/hasOwnProperty/,String(n))),"name"in r||(r.name=n)}t===o?t[n]=r:(e||delete t[n],u(t,n,r))}var o=r(/*! ./$.global */3),i=r(/*! ./$.has */9),u=r(/*! ./$.hide */4),c=r(/*! ./$.is-function */14),a=String({}.hasOwnProperty),f=r(/*! ./$.uid */19)("src"),s=Function.toString;e(Function.prototype,"toString",function(){return i(this,f)?this[f]:s.call(this)}),r(/*! ./$.core */2).inspectSource=function(t){return s.call(t)},t.exports=e},/*!*******************************************!*\ !*** ./~/core-js/modules/$.to-integer.js ***! \*******************************************/ function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},/*!************************************!*\ !*** ./~/core-js/modules/$.uid.js ***! \************************************/ function(t,n){var r=0;t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+Math.random()).toString(36))}},/*!************************************!*\ !*** ./~/core-js/fn/array/from.js ***! \************************************/ function(t,n,r){r(/*! ../../modules/es6.string.iterator */42),r(/*! ../../modules/es6.array.from */39),t.exports=r(/*! ../../modules/$.core */2).Array.from},/*!***************************************!*\ !*** ./~/core-js/fn/object/assign.js ***! \***************************************/ function(t,n,r){r(/*! ../../modules/es6.object.assign */40),t.exports=r(/*! ../../modules/$.core */2).Object.assign},/*!*******************************************!*\ !*** ./~/core-js/fn/reflect/enumerate.js ***! \*******************************************/ function(t,n,r){r(/*! ../../modules/es6.reflect.enumerate */41),t.exports=r(/*! ../../modules/$.core */2).Reflect.enumerate},/*!*******************************************!*\ !*** ./~/core-js/modules/$.a-function.js ***! \*******************************************/ function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},/*!***************************************!*\ !*** ./~/core-js/modules/$.assign.js ***! \***************************************/ function(t,n,r){var e=r(/*! ./$ */5),o=r(/*! ./$.enum-keys */26),i=r(/*! ./$.defined */8);t.exports=Object.assign||function(t,n){for(var r=Object(i(t)),u=arguments.length,c=1;u>c;)for(var a,f=e.ES5Object(arguments[c++]),s=o(f),l=s.length,p=0;l>p;)r[a=s[p++]]=f[a];return r}},/*!************************************!*\ !*** ./~/core-js/modules/$.ctx.js ***! \************************************/ function(t,n,r){var e=r(/*! ./$.a-function */23);t.exports=function(t,n,r){if(e(t),~r&&void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},/*!******************************************!*\ !*** ./~/core-js/modules/$.enum-keys.js ***! \******************************************/ function(t,n,r){var e=r(/*! ./$ */5);t.exports=function(t){var n=e.getKeys(t),r=e.isEnum,o=e.getSymbols;if(o)for(var i,u=o(t),c=0;u.length>c;)r.call(t,i=u[c++])&&n.push(i);return n}},/*!**********************************************!*\ !*** ./~/core-js/modules/$.is-array-iter.js ***! \**********************************************/ function(t,n,r){var e=r(/*! ./$.iterators */10),o=r(/*! ./$.wks */1)("iterator");t.exports=function(t){return("Array"in e?e.Array:Array.prototype[o])===t}},/*!******************************************!*\ !*** ./~/core-js/modules/$.is-object.js ***! \******************************************/ function(t,n){t.exports=function(t){return null!==t&&("object"==typeof t||"function"==typeof t)}},/*!*******************************************!*\ !*** ./~/core-js/modules/$.iter-buggy.js ***! \*******************************************/ function(t,n){t.exports="keys"in[]&&!("next"in[].keys())},/*!******************************************!*\ !*** ./~/core-js/modules/$.iter-call.js ***! \******************************************/ function(t,n,r){function e(t){var n=t["return"];void 0!==n&&i(n.call(t))}function o(t,n,r,o){try{return o?n(i(r)[0],r[1]):n(r)}catch(u){throw e(t),u}}var i=r(/*! ./$.an-object */13);o.close=e,t.exports=o},/*!********************************************!*\ !*** ./~/core-js/modules/$.iter-define.js ***! \********************************************/ function(t,n,r){"use strict";function e(){return this}var o=r(/*! ./$ */5),i=r(/*! ./$.library */33),u=r(/*! ./$.def */6),c=r(/*! ./$.redef */17),a=r(/*! ./$.hide */4),f=r(/*! ./$.has */9),s=r(/*! ./$.cof */7),l=r(/*! ./$.wks */1)("iterator"),p=r(/*! ./$.iterators */10),h="@@iterator",v="keys",y="values";t.exports=function(t,n,d,g,m,x,b){function _(t){function n(n){return new d(n,t)}switch(t){case v:return function(){return n(this)};case y:return function(){return n(this)}}return function(){return n(this)}}r(/*! ./$.iter-create */15)(d,n,g);var O,S,j=n+" Iterator",w=t.prototype,P=w[l]||w[h]||m&&w[m],A=P||_(m);if(P){var M=o.getProto(A.call(new t));s.set(M,j,!0),!i&&f(w,h)&&a(M,l,e)}if((!i||b)&&a(w,l,A),p[n]=A,p[j]=e,m)if(O={keys:x?A:_(v),values:m==y?A:_(y),entries:m!=y?A:_("entries")},b)for(S in O)S in w||c(w,S,O[S]);else u(u.P+u.F*r(/*! ./$.iter-buggy */29),n,O)}},/*!********************************************!*\ !*** ./~/core-js/modules/$.iter-detect.js ***! \********************************************/ function(t,n,r){var e=r(/*! ./$.wks */1)("iterator"),o=!1;try{var i=[7][e]();i["return"]=function(){o=!0},Array.from(i,function(){throw 2})}catch(u){}t.exports=function(t){if(!o)return!1;var n=!1;try{var r=[7],i=r[e]();i.next=function(){n=!0},r[e]=function(){return i},t(r)}catch(u){}return n}},/*!****************************************!*\ !*** ./~/core-js/modules/$.library.js ***! \****************************************/ function(t,n){t.exports=!1},/*!***************************************!*\ !*** ./~/core-js/modules/$.shared.js ***! \***************************************/ function(t,n,r){var e=r(/*! ./$.global */3),o="__core-js_shared__",i=e[o]||(e[o]={});t.exports=function(t){return i[t]||(i[t]={})}},/*!******************************************!*\ !*** ./~/core-js/modules/$.string-at.js ***! \******************************************/ function(t,n,r){var e=r(/*! ./$.to-integer */18),o=r(/*! ./$.defined */8);t.exports=function(t){return function(n,r){var i,u,c=String(o(n)),a=e(r),f=c.length;return 0>a||a>=f?t?"":void 0:(i=c.charCodeAt(a),55296>i||i>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):i:t?c.slice(a,a+2):(i-55296<<10)+(u-56320)+65536)}}},/*!*********************************************!*\ !*** ./~/core-js/modules/$.support-desc.js ***! \*********************************************/ function(t,n){t.exports=!!function(){try{return 2==Object.defineProperty({},"a",{get:function(){return 2}}).a}catch(t){}}()},/*!******************************************!*\ !*** ./~/core-js/modules/$.to-length.js ***! \******************************************/ function(t,n,r){var e=r(/*! ./$.to-integer */18),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},/*!*******************************************************!*\ !*** ./~/core-js/modules/core.get-iterator-method.js ***! \*******************************************************/ function(t,n,r){var e=r(/*! ./$.global */3),o=r(/*! ./$.cof */7).classof,i=r(/*! ./$.wks */1)("iterator"),u=r(/*! ./$.iterators */10);t.exports=r(/*! ./$.core */2).getIteratorMethod=function(t){var n=e.Symbol;return void 0!=t?t[n&&n.iterator||"@@iterator"]||t[i]||u[o(t)]:void 0}},/*!*********************************************!*\ !*** ./~/core-js/modules/es6.array.from.js ***! \*********************************************/ function(t,n,r){var e=r(/*! ./$.ctx */25),o=r(/*! ./$.def */6),i=r(/*! ./$.defined */8),u=r(/*! ./$.iter-call */30),c=r(/*! ./$.is-array-iter */27),a=r(/*! ./$.to-length */37),f=r(/*! ./core.get-iterator-method */38);o(o.S+o.F*!r(/*! ./$.iter-detect */32)(function(t){Array.from(t)}),"Array",{from:function(t){var n,r,o,s,l=Object(i(t)),p="function"==typeof this?this:Array,h=arguments[1],v=void 0!==h,y=0,d=f(l);if(v&&(h=e(h,arguments[2],2)),void 0==d||p==Array&&c(d))for(r=new p(n=a(l.length));n>y;y++)r[y]=v?h(l[y],y):l[y];else for(s=d.call(l),r=new p;!(o=s.next()).done;y++)r[y]=v?u(s,h,[o.value,y],!0):o.value;return r.length=y,r}})},/*!************************************************!*\ !*** ./~/core-js/modules/es6.object.assign.js ***! \************************************************/ function(t,n,r){var e=r(/*! ./$.def */6);e(e.S,"Object",{assign:r(/*! ./$.assign */24)})},/*!****************************************************!*\ !*** ./~/core-js/modules/es6.reflect.enumerate.js ***! \****************************************************/ function(t,n,r){function e(t){this._t=u(t),this._k=void 0,this._i=0}var o=r(/*! ./$.def */6),i=r(/*! ./$.wks */1)("iterator"),u=r(/*! ./$.an-object */13),c=r(/*! ./$.global */3).Reflect,a=!(c&&c.enumerate&&i in c.enumerate({}));r(/*! ./$.iter-create */15)(e,"Object",function(){var t,n=this,r=n._k;if(void 0==r){n._k=r=[];for(t in n._t)r.push(t)}do if(n._i>=r.length)return{value:void 0,done:!0};while(!((t=r[n._i++])in n._t));return{value:t,done:!1}}),o(o.S+o.F*a,"Reflect",{enumerate:function(t){return new e(t)}})},/*!**************************************************!*\ !*** ./~/core-js/modules/es6.string.iterator.js ***! \**************************************************/ function(t,n,r){var e=r(/*! ./$.string-at */35)(!0);r(/*! ./$.iter-define */31)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})}])); //# sourceMappingURL=index.js.map