+import t from"lodash.filter";import n from"lodash.last";import r from"lodash.chunk";import e from"lodash.isplainobject";import o from"lodash.isfunction";import u from"lodash.get";function i(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var c=function(t,n,r){return u(t,n)==r},f=function(t,n,r){var e=u(t,n);return r.match(/^([^*])(\w*)([*])$/)?String(e).startsWith(r.replace(/\*$/,"")):r.match(/^([*])(\w*)([^*])$/)?String(e).endsWith(r.replace(/^\*/,"")):!!r.match(/^\*\w*\*$/)&&String(e).includes(r.replace(/^\*/,"").replace(/\*$/,""))},a=/*#__PURE__*/function(){function t(){}return t.factory=function(t,n,r){if(this.PREDICATES.includes(t)&&this[t])return o(r)&&(r=r()),this[t](n,r)},t.matches=function(t,n){return function(r){var e=[u(r,t)].flatMap(function(t){return t});return(n=[n].flatMap(function(t){return t})).some(function(t){return e.includes(t)})}},t.not_matches=function(t,n){return!this.matches(t,n)},t.exists=function(t,n){var r=this;return function(e){return"true"==String(n)?r.not_in(t,["",null,void 0])(e):r.in(t,["",null,void 0])(e)}},t.not_exists=function(t,n){var r=this;return function(n){return r.exists(t,!1)(n)}},t.ex=function(t,n){var r=this;return function(n){return r.exists(t,!0)(n)}},t.not_ex=function(t,n){var r=this;return function(n){return r.exists(t,!1)(n)}},t.in=function(t,n){var r=this;return function(e){return r.matches(t,n)(e)}},t.not_in=function(t,n){var r=this;return function(e){return!r.matches(t,n)(e)}},t.eq=function(t,n){return function(r){return c(r,t,n)}},t.not_eq=function(t,n){return function(r){return!c(r,t,n)}},t.gte=function(t,n){return function(r){return u(r,t)>=n}},t.gt=function(t,n){return function(r){return u(r,t)>n}},t.lte=function(t,n){return function(r){return u(r,t)<=n}},t.lt=function(t,n){return function(r){return u(r,t)<n}},t.cont=function(t,n){return function(r){return f(r,t,n)}},t.not_cont=function(t,n){return function(r){return!f(r,t,n)}},t.starts_with=function(t,n){return function(r){return f(r,t,n+"*")}},t.not_starts_with=function(t,n){return function(r){return!f(r,t,n+"*")}},t.st=function(t,n){return function(r){return f(r,t,n+"*")}},t.not_st=function(t,n){return function(r){return!f(r,t,n+"*")}},t}();a.PREDICATES=["eq","not_eq","gte","lte","gt","lt","matches","not_matches","in","not_in","cont","not_cont","starts_with","not_starts_with","st","not_st","exists","not_exists","ex","not_ex"];var s=function(n,r,e,o){return t(n,a.factory(r,e,o))},l=function(t,n,r){for(var e=0,o=Object.entries(r);e<o.length;e++){var u=o[e];t=s(t,u[0],n,u[1])}return t},h=function(t,r,e){var o=r.split("_"),u=n(o),i=r.replace("_"+u,"");return s(t,u,i,e)},m=/*#__PURE__*/function(){function t(){}return t.filter=function(t,n){var r=Array.from(t);return this.recollect(r,n)},t}();m.recollect=function(t,n){for(var o,u=Object.entries(n).flatMap(function(t){return t}),c=function(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return i(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,n):void 0}}(t))){r&&(t=r);var e=0;return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r(u,2));!(o=c()).done;){var f=o.value,a=f[0],s=f[1];t=e(s)?l(t,a,s):h(t,a,n[a])}return t};export{m as RecollectArray,m as default};
0 commit comments