frexp
Version:
2 lines (1 loc) • 2.25 kB
JavaScript
var t=require("./_rollupPluginBabelHelpers-aESfU7SF.js"),e=["total"],r=function(r){function a(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;t._classCallCheck(this,a);var o=(r=t._callSuper(this,a,[e])).toArray(null==n?void 0:n.param);if(n){var i,u;if("boolean"==typeof n&&n)return t._possibleConstructorReturn(r,t._defineProperty({},null!==(i=r.wrap)&&void 0!==i?i:"data",o));if("object"===t._typeof(n))if(n.wrap)return t._possibleConstructorReturn(r,t._defineProperty({},null!==(u=r.wrap)&&void 0!==u?u:"data",o))}return t._possibleConstructorReturn(r,o)}return t._inherits(a,r),t._createClass(a,[{key:"merge",value:function(t,e){return t?e:void 0}},{key:"toArray",value:function(){return Object.assign({},this.resource)}},{key:"convertTypeData",value:function(t,e){return"NUMBER"===e?Number(t):"BOOLEAN"===e?Boolean(t):t}}],[{key:"wrap",get:function(){return"data"}},{key:"collection",value:function(e){var r,a,n,o=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,u=(e=e||[]).data?e.data:e,l=u.map((function(t){return new o(t,{param:null==i?void 0:i.param})}));return e.data?Object.assign({},e,t._defineProperty({},null!==(r=this.wrap)&&void 0!==r?r:"data",l)):"boolean"==typeof i&&i?t._defineProperty({},null!==(a=this.wrap)&&void 0!==a?a:"data",l):"object"===t._typeof(i)&&i.wrap?t._defineProperty({},null!==(n=this.wrap)&&void 0!==n?n:"data",l):l}},{key:"paginate",value:function(r){var a,n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=r.total,u=t._objectWithoutProperties(r,e);if(u.hasOwnProperty("results")){var l,s=u.results.map((function(t){return new n(t,{param:null==o?void 0:o.param})}));return t._defineProperty({total:+i},null!==(l=this.wrap)&&void 0!==l?l:"data",s)}var p=u.data.map((function(t){return new n(t,{param:null==o?void 0:o.param})}));return t._defineProperty({total:+i},null!==(a=this.wrap)&&void 0!==a?a:"data",p)}}])}(t._createClass((function e(r){return t._classCallCheck(this,e),t._defineProperty(this,"resource",void 0),t._defineProperty(this,"proxy",void 0),r instanceof Object||(r={}),this.resource=r,this.proxy=new Proxy(this,{get:function(t,e){return void 0!==t[e]?t[e]:void 0!==r[e]?r[e]:null}}),this.proxy})));module.exports=r;
;