@minionorg/share
Version:
2 lines (1 loc) • 1.57 kB
JavaScript
(function(n,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.index={}))})(this,function(n){"use strict";var y=Object.defineProperty;var N=(n,r,s)=>r in n?y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var u=(n,r,s)=>(N(n,typeof r!="symbol"?r+"":r,s),s);function r(...e){if(e===null)return!1;for(const t of e)if(t===null)return!1;return!0}function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){if(!e)throw new SyntaxError("type is must");return function(t){return Object.prototype.toString.call(t)===`[object ${s(e)}]`}}const l=c("Function");class o{constructor(t,i="nextSuccessor"){u(this,"fn");u(this,"nextNode");u(this,"nextFlag");if(!l(t))throw new Error(`${t} is no a function`);this.fn=t,this.nextNode=null,this.nextFlag=i}after(t,i=this.nextFlag){const x=t instanceof o;return this.nextNode=x?t:new o(t,i)}start(...t){const i=this.fn.apply(this,t);return i===this.nextFlag?this.next.apply(this,t):i}next(){return this.nextNode&&this.nextNode.start.apply(this.nextNode,arguments)}}const a=c("Object"),p=function(e){return Object.getOwnPropertyNames(e).length===0?!0:"nextSuccessor"},h=function(e){return Object.keys(e).length===0};function f(e){if(!a(e))throw new Error(`${e} is no a object type`);const t=new o(p);return t.after(h),t.start(e)}const d={allNotNull:r,isEmpty:f};n.allNotNull=r,n.default=d,n.isEmpty=f,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});