@stacksjs/collections 0.65.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -4
- package/package.json +3 -5
- package/dist/index.js.map +0 -17
- package/src/helpers/clone.ts +0 -17
- package/src/helpers/delete-keys.ts +0 -16
- package/src/helpers/index.ts +0 -6
- package/src/helpers/is.ts +0 -23
- package/src/helpers/nested-value.ts +0 -17
- package/src/helpers/values.ts +0 -19
- package/src/helpers/variadic.ts +0 -13
- package/src/index.ts +0 -2024
package/dist/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
var{create:g,defineProperty:A,getOwnPropertyDescriptor:f,getOwnPropertyNames:p,getPrototypeOf:d}=Object,v=Object.prototype.hasOwnProperty,m=(T,w)=>()=>(w||T((w={exports:{}}).exports,w),w.exports),r=(T,w)=>{for(var E in w)A(T,E,{get:w[E],enumerable:!0})},z=(T,w,E,L)=>{if(w&&typeof w=="object"||typeof w=="function")for(let _ of p(w))!v.call(T,_)&&_!==E&&A(T,_,{get:()=>w[_],enumerable:!(L=f(w,_))||L.enumerable});return T},s=(T,w,E)=>(z(T,w,"default"),E&&z(E,w,"default")),V=(T,w,E)=>(E=T!=null?g(d(T)):{},z(w||!T||!T.__esModule?A(E,"default",{value:T,enumerable:!0}):E,T)),C=m((T,w)=>{var E=w.exports={},L,_;function Q(){throw new Error("setTimeout has not been defined")}function U(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?L=setTimeout:L=Q}catch{L=Q}try{typeof clearTimeout=="function"?_=clearTimeout:_=U}catch{_=U}})();function Y(X){if(L===setTimeout)return setTimeout(X,0);if((L===Q||!L)&&setTimeout)return L=setTimeout,setTimeout(X,0);try{return L(X,0)}catch{try{return L.call(null,X,0)}catch{return L.call(this,X,0)}}}function q(X){if(_===clearTimeout)return clearTimeout(X);if((_===U||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(X);try{return _(X)}catch{try{return _.call(null,X)}catch{return _.call(this,X)}}}var J=[],$=!1,R,M=-1;function b(){!$||!R||($=!1,R.length?J=R.concat(J):M=-1,J.length&&j())}function j(){if(!$){var X=Y(b);$=!0;for(var S=J.length;S;){for(R=J,J=[];++M<S;)R&&R[M].run();M=-1,S=J.length}R=null,$=!1,q(X)}}E.nextTick=function(X){var S=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)S[I-1]=arguments[I];J.push(new h(X,S)),J.length===1&&!$&&Y(j)};function h(X,S){this.fun=X,this.array=S}h.prototype.run=function(){this.fun.apply(null,this.array)},E.title="browser",E.browser=!0,E.env={},E.argv=[],E.version="",E.versions={};function N(){}E.on=N,E.addListener=N,E.once=N,E.off=N,E.removeListener=N,E.removeAllListeners=N,E.emit=N,E.prependListener=N,E.prependOnceListener=N,E.listeners=function(X){return[]},E.binding=function(X){throw new Error("process.binding is not supported")},E.cwd=function(){return"/"},E.chdir=function(X){throw new Error("process.chdir is not supported")},E.umask=function(){return 0}}),F={};r(F,{default:()=>K});s(F,V(C()));var K=V(C());function x(T){if(Array.isArray(T))return[...T];return{...T}}function O(T){if(Array.isArray(T))return T;return[T]}function P(T,...w){O(w).forEach((E)=>{delete T[E]})}function W(T){return typeof T==="object"&&!Array.isArray(T)&&T!==null}var B=(T)=>Array.isArray(T),Z=(T)=>typeof T==="function";function G(T,w){try{return w.split(".").reduce((E,L)=>E[L],T)}catch(E){return T}}function D(T){if(Array.isArray(T))return[...T];if("all"in T&&typeof T.all==="function")return T.all();return Object.values(T)}function n(T){return new H(T)}function y(){let T=-1;return{next:()=>{return T+=1,{value:this.items[T],done:T>=this.items.length}}}}class H{items;constructor(T=[]){this.items=T}[Symbol.iterator]=y;toJSON(){return this.items}all(){return this.items}average(T){if(T===void 0)return this.sum()/Number(this.items.length);if(Z(T))return Number(new this.constructor(this.items).sum(T))/Number(this.items.length);return Number(new this.constructor(this.items).pluck(T).sum())/Number(this.items.length)}avg=this.average;chunk(T){const w=[],E=Array.isArray(this.items)?this.items:Object.values(this.items);for(let L=0;L<E.length;L+=T)w.push(E.slice(L,L+T));return new H(w)}collapse(){return new this.constructor([].concat(...this.items))}combine(T){if(typeof T==="string")T=[T];if(!Array.isArray(T))throw new TypeError("The values must be an array or a string");const w={};return(Array.isArray(this.items)?this.items:Object.keys(this.items)).forEach((L,_)=>{if(T[_]!==void 0)w[L]=T[_]}),new H(w)}concat(T){let w=T;if(T instanceof this.constructor)w=T.all();else if(typeof T==="object")w=[],Object.keys(T).forEach((L)=>{w.push(T[L])});const E=x(this.items);return w.forEach((L)=>{if(typeof L==="object")Object.keys(L).forEach((_)=>E.push(L[_]));else E.push(L)}),new this.constructor(E)}contains(T,w){if(typeof T==="function")return this.items.some(T);if(Array.isArray(this.items))return this.items.includes(T);if(w!==void 0){if(Array.isArray(this.items))return this.items.some((E)=>E[T]!==void 0&&E[T]===w);return T in this.items&&this.items[T]===w}if(Array.isArray(this.items))return this.items.includes(T);return Object.values(this.items).includes(T)}containsOneItem(){if(typeof this.items==="string")return!0;return Object.keys(this.items).length===1}count(T){if(T)return this.filter(T).count();return Object.keys(this.items).length}countBy(T){const w={};return this.each((E)=>{const L=T?T(E):E;w[L]=(w[L]||0)+1}),new H(w)}crossJoin(...T){function w(E,L,_){let Q=_[0];if(Q instanceof H)Q=Q.all();const U=_.slice(1),Y=!U.length;let q=[];for(let J=0;J<Q.length;J+=1){const $=E.slice();if($.push(Q[J]),Y)q.push($);else q=q.concat(w($,L,U))}return q}return new this.constructor(w([],this.constructor,[].concat([this.items],T)))}dd(){console.log(JSON.stringify(this.all(),null,2)),K.exit()}diff(T){let w;if(T instanceof this.constructor)w=T.all();else w=T;const E=this.items.filter((L)=>!w.includes(L));return new this.constructor(E)}diffAssoc(T){let w=T;if(T instanceof this.constructor)w=T.all();const E={};return Object.keys(this.items).forEach((L)=>{if(w[L]===void 0||w[L]!==this.items[L])E[L]=this.items[L]}),new this.constructor(E)}diffKeys(T){let w;if(T instanceof this.constructor)w=T.all();else w=T;const E=Object.keys(w),L=Object.keys(this.items).filter((_)=>!E.includes(_));return new this.constructor(this.items).only(L)}diffUsing(T,w){if(console.log("Original collection:",this.items),console.log("Array to compare:",T),T===null)return new H(this.items);const E=this.items.filter((L)=>{return T.findIndex((Q)=>{return w(L,Q)===0})===-1});return new H(E)}doesntContain(T,w){if(console.log("doesntContain called with:",{key:T,value:w}),typeof T==="function")return console.log("Function branch"),!this.contains(T);if(w!==void 0)return console.log("Key-value pair branch"),!this.contains((E)=>{return console.log("Comparing:",E[T],"with",w),E[T]===w});return console.log("Single value branch"),!this.contains(T)}dump(){return console.log(this.items),this}duplicates(){const T=[],w={},E=(L)=>{if(Array.isArray(L)||typeof L==="object")return JSON.stringify(L);return L};if(Array.isArray(this.items))this.items.forEach((L,_)=>{const Q=E(L);if(!T.includes(Q))T.push(Q);else w[_]=L});else if(typeof this.items==="object")Object.keys(this.items).forEach((L)=>{const _=E(this.items[L]);if(!T.includes(_))T.push(_);else w[L]=this.items[L]});return new this.constructor(w)}each(T){let w=!1;if(Array.isArray(this.items)){const{length:E}=this.items;for(let L=0;L<E&&!w;L+=1)w=T(this.items[L],L,this.items)===!1}else{const E=Object.keys(this.items),{length:L}=E;for(let _=0;_<L&&!w;_+=1){const Q=E[_];w=T(this.items[Q],Q,this.items)===!1}}return this}eachSpread(T){return this.each((w,E)=>{T(...w,E)}),this}every(T){return D(this.items).every(T)}except(T){const w={...this.items};return(Array.isArray(T)?T:[T]).forEach((L)=>delete w[L]),new H(w)}filter(T){if(console.log("Filter method called with callback:",T),console.log("Current items:",this.items),typeof T!=="function"){console.log("No callback provided, removing falsy values");const E=this.items.filter((L)=>{return console.log("Filtering item:",L),Boolean(L)});return console.log("Filtered items:",E),new H(E)}const w=this.items.filter((E,L)=>{return console.log("Filtering item:",E,"at index:",L),T(E,L)});return console.log("Filtered items:",w),new H(w)}first(T,w){if(Z(T)){const E=Object.keys(this.items);for(let L=0;L<E.length;L+=1){const _=E[L],Q=this.items[_];if(T(Q,_))return Q}if(Z(w))return w();return w}if(Array.isArray(this.items)&&this.items.length||Object.keys(this.items).length){if(Array.isArray(this.items))return this.items[0];const E=Object.keys(this.items)[0];return this.items[E]}if(Z(w))return w();return w}firstOrFail(T){const w=this.items.find(T||(()=>!0));if(w===void 0)throw new Error("Item not found.");return w}firstWhere(T,w,E){return this.where(T,w,E).first()||null}flatMap(T){return this.map(T).collapse()}flatten(T=Number.POSITIVE_INFINITY){const w=(E,L)=>{if(!Array.isArray(E)&&typeof E!=="object")return[E];return L>0?Object.values(E).reduce((_,Q)=>_.concat(Array.isArray(Q)||typeof Q==="object"?w(Q,L-1):Q),[]):Array.isArray(E)?[...E]:[E]};return new H(w(this.items,T))}flip(){const T={};if(Array.isArray(this.items))this.items.forEach((w,E)=>{T[w]=E});else Object.entries(this.items).forEach(([w,E])=>{T[E]=w});return new this.constructor(T)}forPage(T,w){let E={};if(Array.isArray(this.items))E=this.items.slice(T*w-w,T*w);else Object.keys(this.items).slice(T*w-w,T*w).forEach((L)=>{E[L]=this.items[L]});return new this.constructor(E)}forget(T){if(Array.isArray(this.items))this.items=this.items.filter((w,E)=>E!==Number.parseInt(T,10));else if(typeof this.items==="object"&&this.items!==null)delete this.items[T];return this}get(T,w=null){if(Array.isArray(this.items))return this.items[T]??w;return this.items[T]??w}groupBy(T){const w={};return this.each((E,L)=>{const _=typeof T==="function"?T(E):E[T];if(!(_ in w))w[_]=new H;w[_].push(E)}),new H(w)}has(T){if(Array.isArray(this.items))return T in this.items;return T in this.items}implode(T,w){if(w===void 0)return this.items.join(T);return new this.constructor(this.items).pluck(T).all().join(w)}includes(T){if(Array.isArray(this.items))return this.items.includes(T);return Object.values(this.items).includes(T)}intersect(T){let w=T;if(T instanceof this.constructor)w=T.all();const E=this.items.filter((L)=>w.includes(L));return new this.constructor(E)}intersectByKeys(T){let w=Object.keys(T);if(T instanceof this.constructor)w=Object.keys(T.all());const E={};return Object.keys(this.items).forEach((L)=>{if(w.includes(L))E[L]=this.items[L]}),new this.constructor(E)}isEmpty(){return this.count()===0}isNotEmpty(){return!this.isEmpty()}join(T,w){const E=this.values();if(w===void 0)return E.implode(T);const L=E.count();if(L===0)return"";if(L===1)return E.last();const _=E.pop();return E.implode(T)+w+_}keyBy(T){const w={};if(Z(T))this.items.forEach((E)=>{w[T(E)]=E});else this.items.forEach((E)=>{const L=G(E,T);w[L||""]=E});return new this.constructor(w)}keys(){return new H(Object.keys(this.items))}last(T,w){let{items:E}=this;if(Z(T))E=this.filter(T).all();if(Array.isArray(E)&&!E.length||!Object.keys(E).length){if(Z(w))return w();return w}if(Array.isArray(E))return E[E.length-1];const L=Object.keys(E);return E[L[L.length-1]]}macro(T,w){this.constructor.prototype[T]=w}make(T=[]){return new this.constructor(T)}map(T){if(Array.isArray(this.items))return new this.constructor(this.items.map(T));const w={};return Object.keys(this.items).forEach((E)=>{w[E]=T(this.items[E],Number(E))}),new this.constructor(w)}mapSpread(T){return this.map((w,E)=>T(...w,E))}mapToDictionary(T){const w={};return this.items.forEach((E,L)=>{const[_,Q]=T(E,L);if(w[_]===void 0)w[_]=[Q];else w[_].push(Q)}),new this.constructor(w)}mapInto(T){return this.map((w,E)=>new T(w,E))}mapToGroups(T){const w={};return this.items.forEach((E,L)=>{const[_,Q]=T(E,L);if(w[_]===void 0)w[_]=[Q];else w[_].push(Q)}),new this.constructor(w)}mapWithKeys(T){const w={};if(Array.isArray(this.items))this.items.forEach((E,L)=>{const[_,Q]=T(E,L);w[_]=Q});else Object.keys(this.items).forEach((E)=>{const[L,_]=T(this.items[E],Number(E));w[L]=_});return new this.constructor(w)}max(T){if(typeof T==="string"){const w=this.items.filter((E)=>E[T]!==void 0);return Math.max(...w.map((E)=>E[T]))}return Math.max(...this.items)}median(T){const{length:w}=this.items;if(T===void 0){if(w%2===0)return(this.items[w/2-1]+this.items[w/2])/2;return this.items[Math.floor(w/2)]}if(w%2===0)return(this.items[w/2-1][T]+this.items[w/2][T])/2;return this.items[Math.floor(w/2)][T]}merge(T){const w={...this.items,...T};return new H(w)}mergeRecursive(T){const w=(E,L)=>{const _={};return Object.keys({...E,...L}).forEach((U)=>{if(E[U]===void 0&&L[U]!==void 0)_[U]=L[U];else if(E[U]!==void 0&&L[U]===void 0)_[U]=E[U];else if(E[U]!==void 0&&L[U]!==void 0)if(E[U]===L[U])_[U]=E[U];else if(!Array.isArray(E[U])&&typeof E[U]==="object"&&!Array.isArray(L[U])&&typeof L[U]==="object")_[U]=w(E[U],L[U]);else _[U]=[].concat(E[U],L[U])}),_};if(!T)return this;if(T.constructor.name==="Collection")return new this.constructor(w(this.items,T.all()));return new this.constructor(w(this.items,T))}min(T){if(T!==void 0){const w=this.items.filter((E)=>E[T]!==void 0);return Math.min(...w.map((E)=>E[T]))}return Math.min(...this.items)}mode(T){const w=[];let E=1;if(!this.items.length)return null;return this.items.forEach((L)=>{const _=w.filter((Q)=>{if(T!==void 0)return Q.key===L[T];return Q.key===L});if(!_.length)if(T!==void 0)w.push({key:L[T],count:1});else w.push({key:L,count:1});else{_[0].count+=1;const{count:Q}=_[0];if(Q>E)E=Q}}),w.filter((L)=>L.count===E).map((L)=>L.key)}nth(T,w=0){const L=D(this.items).slice(w).filter((_,Q)=>Q%T===0);return new this.constructor(L)}only(T){const w={};return T.forEach((E)=>{if(E in this.items)w[E]=this.items[E]}),new H(w)}pad(T,w){const E=Math.abs(T),L=this.count();if(E<=L)return this;let _=E-L;const Q=x(this.items),U=Array.isArray(this.items),Y=T<0;for(let q=0;q<_;){if(!U)if(Q[q]!==void 0)_+=1;else Q[q]=w;else if(Y)Q.unshift(w);else Q.push(w);q+=1}return new this.constructor(Q)}partition(T){let w;if(Array.isArray(this.items))w=[new this.constructor([]),new this.constructor([])],this.items.forEach((E)=>{if(T(E)===!0)w[0].push(E);else w[1].push(E)});else w=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach((E)=>{const L=this.items[E];if(T(L)===!0)w[0].put(E,L);else w[1].put(E,L)});return new this.constructor(w)}pipe(T){return T(this)}pluck(T,w){if(T.includes("*")){const E=o(this.items),L=[];if(w!==void 0){const Y=new RegExp(`0.${w}`,"g"),q=`0.${w}`.split(".").length;Object.keys(E).forEach((J)=>{const $=J.match(Y);if($){const R=$[0];if(R.split(".").length===q)L.push(E[R])}})}const _=[],Q=new RegExp(`0.${T}`,"g"),U=`0.${T}`.split(".").length;if(Object.keys(E).forEach((Y)=>{const q=Y.match(Q);if(q){const J=q[0];if(J.split(".").length===U)_.push(E[J])}}),w!==void 0){const Y={};return this.items.forEach((q,J)=>{Y[L[J]||""]=_}),new this.constructor(Y)}return new this.constructor([_])}if(w!==void 0){const E={};return this.items.forEach((L)=>{if(G(L,T)!==void 0)E[L[w]||""]=G(L,T);else E[L[w]||""]=null}),new this.constructor(E)}return this.map((E)=>{if(G(E,T)!==void 0)return G(E,T);return null})}pop(T=1){if(this.isEmpty())return null;if(B(this.items)){if(T===1)return this.items.pop();return new this.constructor(this.items.splice(-T))}if(W(this.items)){const w=Object.keys(this.items);if(T===1){const _=w[w.length-1],Q=this.items[_];return P(this.items,_),Q}const E=w.slice(-T),L=E.reduce((_,Q)=>{return _[Q]=this.items[Q],_},{});return P(this.items,E),new this.constructor(L)}return null}prepend(T,w){if(w!==void 0)return this.put(w,T);return this.items.unshift(T),this}pull(T,w=null){if(Array.isArray(this.items)){const L=Number(T);if(Number.isNaN(L))return w;const _=this.items[L];return this.items.splice(L,1),_??w}const E=this.items[T];return delete this.items[T],E??w}push(...T){return this.items=[...this.items,...T],this}put(T,w){return this.items[T]=w,this}random(T=null){const w=D(this.items),E=new this.constructor(w).shuffle();if(T!==Number.parseInt(T,10))return E.first();return E.take(T)}reduce(T,w){let E=null;if(w!==void 0)E=w;if(Array.isArray(this.items))this.items.forEach((L)=>{E=T(E,L)});else Object.keys(this.items).forEach((L)=>{E=T(E,this.items[L],L)});return E}reject(T){return new this.constructor(this.items).filter((w)=>!T(w))}replace(T){if(!T)return this;if(Array.isArray(T)){const E=this.items.map((L,_)=>T[_]||L);return new this.constructor(E)}if(T.constructor.name==="Collection"){const E={...this.items,...T.all()};return new this.constructor(E)}const w={...this.items,...T};return new this.constructor(w)}replaceRecursive(T){const w=(E,L)=>{const _={...E};return Object.keys({...E,...L}).forEach((U)=>{if(!Array.isArray(L[U])&&typeof L[U]==="object")_[U]=w(E[U],L[U]);else if(E[U]===void 0&&L[U]!==void 0)if(typeof E[U]==="object")_[U]={...L[U]};else _[U]=L[U];else if(E[U]!==void 0&&L[U]===void 0)if(typeof E[U]==="object")_[U]={...E[U]};else _[U]=E[U];else if(E[U]!==void 0&&L[U]!==void 0)if(typeof L[U]==="object")_[U]={...L[U]};else _[U]=L[U]}),_};if(!T)return this;if(!Array.isArray(T)&&typeof T!=="object")return new this.constructor(w(this.items,[T]));if(T.constructor.name==="Collection")return new this.constructor(w(this.items,T.all()));return new this.constructor(w(this.items,T))}reverse(){const T=[].concat(this.items).reverse();return new this.constructor(T)}search(T,w){let E;const L=(_,Q)=>{if(Z(T))return T(this.items[Q],Q);if(w)return this.items[Q]===T;return this.items[Q]==T};if(B(this.items))E=this.items.findIndex(L);else if(W(this.items))E=Object.keys(this.items).find((_)=>L(this.items[_],_));if(E===void 0||E<0)return!1;return E}shift(T=1){if(this.isEmpty())return null;if(B(this.items)){if(T===1)return this.items.shift();return new this.constructor(this.items.splice(0,T))}if(W(this.items)){if(T===1){const _=Object.keys(this.items)[0],Q=this.items[_];return delete this.items[_],Q}const E=Object.keys(this.items).slice(0,T),L=E.reduce((_,Q)=>{return _[Q]=this.items[Q],_},{});return P(this.items,E),new this.constructor(L)}return null}shuffle(){const T=D(this.items);let w,E,L;for(L=T.length;L;L-=1)w=Math.floor(Math.random()*L),E=T[L-1],T[L-1]=T[w],T[w]=E;return this.items=T,this}skip(T){if(W(this.items))return new this.constructor(Object.keys(this.items).reduce((w,E,L)=>{if(L+1>T)w[E]=this.items[E];return w},{}));return new this.constructor(this.items.slice(T))}skipUntil(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!0)w=L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!0)w=L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}skipWhile(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!0)w=!L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!0)w=!L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}slice(T,w){let E=this.items.slice(T);if(w!==void 0)E=E.slice(0,w);return new this.constructor(E)}sole(){if(this.items.length!==1)throw new Error("Collection does not contain exactly one item.");return this.items[0]}some(T){return this.items.some((w)=>w.hasOwnProperty(T))}sort(T){const w=[].concat(this.items);if(T===void 0)if(this.every((E)=>typeof E==="number"))w.sort((E,L)=>E-L);else w.sort();else w.sort(T);return new this.constructor(w)}sortDesc(){return this.sort().reverse()}sortBy(T){const w=[].concat(this.items),E=(L)=>{if(Z(T))return T(L);return G(L,T)};return w.sort((L,_)=>{const Q=E(L),U=E(_);if(Q===null||Q===void 0)return 1;if(U===null||U===void 0)return-1;if(Q<U)return-1;if(Q>U)return 1;return 0}),new this.constructor(w)}sortByDesc(T){return this.sortBy(T).reverse()}sortKeys(){const T={};return Object.keys(this.items).sort().forEach((w)=>{T[w]=this.items[w]}),new this.constructor(T)}sortKeysDesc(){const T={};return Object.keys(this.items).sort().reverse().forEach((w)=>{T[w]=this.items[w]}),new this.constructor(T)}splice(T,w,E){const L=this.slice(T,w);if(this.items=this.diff(L.all()).all(),Array.isArray(E))for(let _=0,{length:Q}=E;_<Q;_+=1)this.items.splice(T+_,0,E[_]);return L}split(T){const w=this.toArray(),E=[],L=Math.ceil(w.length/T);for(let _=0;_<w.length;_+=L)E.push(w.slice(_,_+L));return new H(E)}sum(T){const w=D(this.items);let E=0;if(T===void 0)for(let L=0,{length:_}=w;L<_;L+=1)E+=Number.parseFloat(w[L]);else if(Z(T))for(let L=0,{length:_}=w;L<_;L+=1)E+=Number.parseFloat(T(w[L]));else for(let L=0,{length:_}=w;L<_;L+=1)E+=Number.parseFloat(w[L][T]);return Number.parseFloat(E.toPrecision(12))}take(T){if(!Array.isArray(this.items)&&typeof this.items==="object"){const w=Object.keys(this.items);let E;if(T<0)E=w.slice(T);else E=w.slice(0,T);const L={};return w.forEach((_)=>{if(E.includes(_))L[_]=this.items[_]}),new this.constructor(L)}if(T<0)return new this.constructor(this.items.slice(T));return new this.constructor(this.items.slice(0,T))}takeUntil(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!1)w=!L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!1)w=!L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}takeWhile(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!1)w=L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!1)w=L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}tap(T){return T(this),this}times(T,w){for(let E=1;E<=T;E+=1)this.items.push(w(E));return this}toArray(){return Array.isArray(this.items)?this.items:Object.values(this.items)}toJson(){return JSON.stringify(this.items)}transform(T){if(Array.isArray(this.items))this.items=this.items.map(T);else{const w={};Object.keys(this.items).forEach((E)=>{w[E]=T(this.items[E],E)}),this.items=w}return this}undot(){if(Array.isArray(this.items))return this;let T={};return Object.keys(this.items).forEach((w)=>{if(w.includes(".")){const E=T;w.split(".").reduce((L,_,Q,U)=>{if(!L[_])L[_]={};if(Q===U.length-1)L[_]=this.items[w];return L[_]},E),T={...T,...E}}else T[w]=this.items[w]}),new this.constructor(T)}unless(T,w,E){if(!T)return w(this);if(E)return E();return}unlessEmpty(T){if(!this.isEmpty())T(this);return this}unlessNotEmpty(T){if(this.isEmpty())T(this);return this}union(T){const w=JSON.parse(JSON.stringify(this.items));return Object.keys(T).forEach((E)=>{if(this.items[E]===void 0)w[E]=T[E]}),new this.constructor(w)}unique(){const T=Array.from(new Set(this.items));return new this.constructor(T)}unwrap(){return this.items}values(){return new H(Object.values(this.items))}when(T,w,E){if(T)w(this,T);else if(E)E();return this}whenEmpty(T,w){if(Array.isArray(this.items)&&!this.items.length)return T(this);if(!Object.keys(this.items).length)return T(this);if(w!==void 0){if(Array.isArray(this.items)&&this.items.length)return w(this);if(Object.keys(this.items).length)return w(this)}return this}whenNotEmpty(T,w){if(Array.isArray(this.items)&&this.items.length)return T(this);if(Object.keys(this.items).length)return T(this);if(w!==void 0){if(Array.isArray(this.items)&&!this.items.length)return w(this);if(!Object.keys(this.items).length)return w(this)}return this}where(T,w,E){if(arguments.length===1)return new H(this.items.filter((_)=>_[T]!==void 0));if(arguments.length===2)E=w,w="===";const L=(_,Q,U,Y)=>{const q=_[Q];switch(Y){case"===":return q===U;case"!==":return q!==U;case"<":return q<U;case"<=":return q<=U;case">":return q>U;case">=":return q>=U;default:return q==U}};return new H(this.items.filter((_)=>L(_,T,E,w)))}whereBetween(T,w){return this.filter((E)=>{const L=typeof E==="object"?E[T]:E;return L>=w[0]&&L<=w[1]})}whereIn(T,w){return this.filter((E)=>{const L=typeof E==="object"?E[T]:E;return w.includes(L)})}whereNotBetween(T,w){return this.filter((E)=>{const L=typeof E==="object"?E[T]:E;return L<w[0]||L>w[1]})}whereNotIn(T,w){const E=this.items.filter((L)=>{const _=T.split(".");let Q=L;for(let U of _){if(Q[U]===void 0)return!0;Q=Q[U]}return!w.includes(Q)});return new H(E)}getNestedValue(T,w){return w.split(".").reduce((L,_)=>L&&L[_]!==void 0?L[_]:null,T)}whereInstanceOf(T){return this.filter((w)=>w instanceof T)}whereNotNull(T){return this.where(T,"!==",null)}whereNull(T){return this.where(T,"===",null)}static wrap(T){if(T instanceof H)return T;return new H(Array.isArray(T)?T:[T])}static unwrap(T){if(T instanceof H)return T.all();return T}wrap(T){if(T instanceof H)return T;if(typeof T==="object")return new H(T);return new H([T])}zip(...T){const w=T.map((L)=>this.constructor.wrap(L).all()),E=this.items.map((L,_)=>{const Q=[L];return w.forEach((U)=>{Q.push(U[_])}),new this.constructor(Q)});return new this.constructor(E)}}var o=function T(w){const E={};return w.forEach((L,_)=>{function Q(U,Y){if(W(U))Object.keys(U).forEach((q)=>{Q(U[q],`${Y}.${q}`)});else if(B(U))U.forEach((q,J)=>{Q(q,`${Y}.${J}`)});E[Y]=U}Q(L,_)}),E},LT=n;export{LT as default,n as collect,H as Collection};
|
|
2
|
-
|
|
3
|
-
//# debugId=4028D12A0E5372FB64756E2164756E21
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var{create:g,defineProperty:A,getOwnPropertyDescriptor:f,getOwnPropertyNames:p,getPrototypeOf:d}=Object,v=Object.prototype.hasOwnProperty,m=(T,w)=>()=>(w||T((w={exports:{}}).exports,w),w.exports),r=(T,w)=>{for(var E in w)A(T,E,{get:w[E],enumerable:!0})},z=(T,w,E,L)=>{if(w&&typeof w=="object"||typeof w=="function")for(let _ of p(w))!v.call(T,_)&&_!==E&&A(T,_,{get:()=>w[_],enumerable:!(L=f(w,_))||L.enumerable});return T},s=(T,w,E)=>(z(T,w,"default"),E&&z(E,w,"default")),V=(T,w,E)=>(E=T!=null?g(d(T)):{},z(w||!T||!T.__esModule?A(E,"default",{value:T,enumerable:!0}):E,T)),C=m((T,w)=>{var E=w.exports={},L,_;function Q(){throw new Error("setTimeout has not been defined")}function U(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?L=setTimeout:L=Q}catch{L=Q}try{typeof clearTimeout=="function"?_=clearTimeout:_=U}catch{_=U}})();function Y(X){if(L===setTimeout)return setTimeout(X,0);if((L===Q||!L)&&setTimeout)return L=setTimeout,setTimeout(X,0);try{return L(X,0)}catch{try{return L.call(null,X,0)}catch{return L.call(this,X,0)}}}function q(X){if(_===clearTimeout)return clearTimeout(X);if((_===U||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(X);try{return _(X)}catch{try{return _.call(null,X)}catch{return _.call(this,X)}}}var J=[],$=!1,R,M=-1;function b(){!$||!R||($=!1,R.length?J=R.concat(J):M=-1,J.length&&j())}function j(){if(!$){var X=Y(b);$=!0;for(var S=J.length;S;){for(R=J,J=[];++M<S;)R&&R[M].run();M=-1,S=J.length}R=null,$=!1,q(X)}}E.nextTick=function(X){var S=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)S[I-1]=arguments[I];J.push(new h(X,S)),J.length===1&&!$&&Y(j)};function h(X,S){this.fun=X,this.array=S}h.prototype.run=function(){this.fun.apply(null,this.array)},E.title="browser",E.browser=!0,E.env={},E.argv=[],E.version="",E.versions={};function N(){}E.on=N,E.addListener=N,E.once=N,E.off=N,E.removeListener=N,E.removeAllListeners=N,E.emit=N,E.prependListener=N,E.prependOnceListener=N,E.listeners=function(X){return[]},E.binding=function(X){throw new Error("process.binding is not supported")},E.cwd=function(){return"/"},E.chdir=function(X){throw new Error("process.chdir is not supported")},E.umask=function(){return 0}}),F={};r(F,{default:()=>K});s(F,V(C()));var K=V(C());function x(T){if(Array.isArray(T))return[...T];return{...T}}function O(T){if(Array.isArray(T))return T;return[T]}function P(T,...w){O(w).forEach((E)=>{delete T[E]})}var B=(T)=>Array.isArray(T);function W(T){return typeof T==="object"&&!Array.isArray(T)&&T!==null}var Z=(T)=>typeof T==="function";function G(T,w){try{return w.split(".").reduce((E,L)=>E[L],T)}catch(E){return T}}function D(T){if(Array.isArray(T))return[...T];if("all"in T&&typeof T.all==="function")return T.all();return Object.values(T)}function n(T){return new H(T)}class H{items;constructor(T=[]){this.items=T}[Symbol.iterator]=y;toJSON(){return this.items}all(){return this.items}average(T){if(T===void 0)return this.sum()/Number(this.items.length);if(Z(T))return Number(new this.constructor(this.items).sum(T))/Number(this.items.length);return Number(new this.constructor(this.items).pluck(T).sum())/Number(this.items.length)}avg=this.average;chunk(T){let w=[],E=Array.isArray(this.items)?this.items:Object.values(this.items);for(let L=0;L<E.length;L+=T)w.push(E.slice(L,L+T));return new H(w)}collapse(){return new this.constructor([].concat(...this.items))}combine(T){if(typeof T==="string")T=[T];if(!Array.isArray(T))throw new TypeError("The values must be an array or a string");let w={};return(Array.isArray(this.items)?this.items:Object.keys(this.items)).forEach((L,_)=>{if(T[_]!==void 0)w[L]=T[_]}),new H(w)}concat(T){let w=T;if(T instanceof this.constructor)w=T.all();else if(typeof T==="object")w=[],Object.keys(T).forEach((L)=>{w.push(T[L])});let E=x(this.items);return w.forEach((L)=>{if(typeof L==="object")Object.keys(L).forEach((_)=>E.push(L[_]));else E.push(L)}),new this.constructor(E)}contains(T,w){if(typeof T==="function")return this.items.some(T);if(Array.isArray(this.items))return this.items.includes(T);if(w!==void 0){if(Array.isArray(this.items))return this.items.some((E)=>E[T]!==void 0&&E[T]===w);return T in this.items&&this.items[T]===w}if(Array.isArray(this.items))return this.items.includes(T);return Object.values(this.items).includes(T)}containsOneItem(){if(typeof this.items==="string")return!0;return Object.keys(this.items).length===1}count(T){if(T)return this.filter(T).count();return Object.keys(this.items).length}countBy(T){let w={};return this.each((E)=>{let L=T?T(E):E;w[L]=(w[L]||0)+1}),new H(w)}crossJoin(...T){function w(E,L,_){let Q=_[0];if(Q instanceof H)Q=Q.all();let U=_.slice(1),Y=!U.length,q=[];for(let J=0;J<Q.length;J+=1){let $=E.slice();if($.push(Q[J]),Y)q.push($);else q=q.concat(w($,L,U))}return q}return new this.constructor(w([],this.constructor,[].concat([this.items],T)))}dd(){console.log(JSON.stringify(this.all(),null,2)),K.exit()}diff(T){let w;if(T instanceof this.constructor)w=T.all();else w=T;let E=this.items.filter((L)=>!w.includes(L));return new this.constructor(E)}diffAssoc(T){let w=T;if(T instanceof this.constructor)w=T.all();let E={};return Object.keys(this.items).forEach((L)=>{if(w[L]===void 0||w[L]!==this.items[L])E[L]=this.items[L]}),new this.constructor(E)}diffKeys(T){let w;if(T instanceof this.constructor)w=T.all();else w=T;let E=Object.keys(w),L=Object.keys(this.items).filter((_)=>!E.includes(_));return new this.constructor(this.items).only(L)}diffUsing(T,w){if(console.log("Original collection:",this.items),console.log("Array to compare:",T),T===null)return new H(this.items);let E=this.items.filter((L)=>{return T.findIndex((Q)=>{return w(L,Q)===0})===-1});return new H(E)}doesntContain(T,w){if(console.log("doesntContain called with:",{key:T,value:w}),typeof T==="function")return console.log("Function branch"),!this.contains(T);if(w!==void 0)return console.log("Key-value pair branch"),!this.contains((E)=>{return console.log("Comparing:",E[T],"with",w),E[T]===w});return console.log("Single value branch"),!this.contains(T)}dump(){return console.log(this.items),this}duplicates(){let T=[],w={},E=(L)=>{if(Array.isArray(L)||typeof L==="object")return JSON.stringify(L);return L};if(Array.isArray(this.items))this.items.forEach((L,_)=>{let Q=E(L);if(!T.includes(Q))T.push(Q);else w[_]=L});else if(typeof this.items==="object")Object.keys(this.items).forEach((L)=>{let _=E(this.items[L]);if(!T.includes(_))T.push(_);else w[L]=this.items[L]});return new this.constructor(w)}each(T){let w=!1;if(Array.isArray(this.items)){let{length:E}=this.items;for(let L=0;L<E&&!w;L+=1)w=T(this.items[L],L,this.items)===!1}else{let E=Object.keys(this.items),{length:L}=E;for(let _=0;_<L&&!w;_+=1){let Q=E[_];w=T(this.items[Q],Q,this.items)===!1}}return this}eachSpread(T){return this.each((w,E)=>{T(...w,E)}),this}every(T){return D(this.items).every(T)}except(T){let w={...this.items};return(Array.isArray(T)?T:[T]).forEach((L)=>delete w[L]),new H(w)}filter(T){if(console.log("Filter method called with callback:",T),console.log("Current items:",this.items),typeof T!=="function"){console.log("No callback provided, removing falsy values");let E=this.items.filter((L)=>{return console.log("Filtering item:",L),Boolean(L)});return console.log("Filtered items:",E),new H(E)}let w=this.items.filter((E,L)=>{return console.log("Filtering item:",E,"at index:",L),T(E,L)});return console.log("Filtered items:",w),new H(w)}first(T,w){if(Z(T)){let E=Object.keys(this.items);for(let L=0;L<E.length;L+=1){let _=E[L],Q=this.items[_];if(T(Q,_))return Q}if(Z(w))return w();return w}if(Array.isArray(this.items)&&this.items.length||Object.keys(this.items).length){if(Array.isArray(this.items))return this.items[0];let E=Object.keys(this.items)[0];return this.items[E]}if(Z(w))return w();return w}firstOrFail(T){let w=this.items.find(T||(()=>!0));if(w===void 0)throw new Error("Item not found.");return w}firstWhere(T,w,E){return this.where(T,w,E).first()||null}flatMap(T){return this.map(T).collapse()}flatten(T=Number.POSITIVE_INFINITY){let w=(E,L)=>{if(!Array.isArray(E)&&typeof E!=="object")return[E];return L>0?Object.values(E).reduce((_,Q)=>_.concat(Array.isArray(Q)||typeof Q==="object"?w(Q,L-1):Q),[]):Array.isArray(E)?[...E]:[E]};return new H(w(this.items,T))}flip(){let T={};if(Array.isArray(this.items))this.items.forEach((w,E)=>{T[w]=E});else Object.entries(this.items).forEach(([w,E])=>{T[E]=w});return new this.constructor(T)}forPage(T,w){let E={};if(Array.isArray(this.items))E=this.items.slice(T*w-w,T*w);else Object.keys(this.items).slice(T*w-w,T*w).forEach((L)=>{E[L]=this.items[L]});return new this.constructor(E)}forget(T){if(Array.isArray(this.items))this.items=this.items.filter((w,E)=>E!==Number.parseInt(T,10));else if(typeof this.items==="object"&&this.items!==null)delete this.items[T];return this}get(T,w=null){if(Array.isArray(this.items))return this.items[T]??w;return this.items[T]??w}groupBy(T){let w={};return this.each((E,L)=>{let _=typeof T==="function"?T(E):E[T];if(!(_ in w))w[_]=new H;w[_].push(E)}),new H(w)}has(T){if(Array.isArray(this.items))return T in this.items;return T in this.items}implode(T,w){if(w===void 0)return this.items.join(T);return new this.constructor(this.items).pluck(T).all().join(w)}includes(T){if(Array.isArray(this.items))return this.items.includes(T);return Object.values(this.items).includes(T)}intersect(T){let w=T;if(T instanceof this.constructor)w=T.all();let E=this.items.filter((L)=>w.includes(L));return new this.constructor(E)}intersectByKeys(T){let w=Object.keys(T);if(T instanceof this.constructor)w=Object.keys(T.all());let E={};return Object.keys(this.items).forEach((L)=>{if(w.includes(L))E[L]=this.items[L]}),new this.constructor(E)}isEmpty(){return this.count()===0}isNotEmpty(){return!this.isEmpty()}join(T,w){let E=this.values();if(w===void 0)return E.implode(T);let L=E.count();if(L===0)return"";if(L===1)return E.last();let _=E.pop();return E.implode(T)+w+_}keyBy(T){let w={};if(Z(T))this.items.forEach((E)=>{w[T(E)]=E});else this.items.forEach((E)=>{let L=G(E,T);w[L||""]=E});return new this.constructor(w)}keys(){return new H(Object.keys(this.items))}last(T,w){let{items:E}=this;if(Z(T))E=this.filter(T).all();if(Array.isArray(E)&&!E.length||!Object.keys(E).length){if(Z(w))return w();return w}if(Array.isArray(E))return E[E.length-1];let L=Object.keys(E);return E[L[L.length-1]]}macro(T,w){this.constructor.prototype[T]=w}make(T=[]){return new this.constructor(T)}map(T){if(Array.isArray(this.items))return new this.constructor(this.items.map(T));let w={};return Object.keys(this.items).forEach((E)=>{w[E]=T(this.items[E],Number(E))}),new this.constructor(w)}mapSpread(T){return this.map((w,E)=>T(...w,E))}mapToDictionary(T){let w={};return this.items.forEach((E,L)=>{let[_,Q]=T(E,L);if(w[_]===void 0)w[_]=[Q];else w[_].push(Q)}),new this.constructor(w)}mapInto(T){return this.map((w,E)=>new T(w,E))}mapToGroups(T){let w={};return this.items.forEach((E,L)=>{let[_,Q]=T(E,L);if(w[_]===void 0)w[_]=[Q];else w[_].push(Q)}),new this.constructor(w)}mapWithKeys(T){let w={};if(Array.isArray(this.items))this.items.forEach((E,L)=>{let[_,Q]=T(E,L);w[_]=Q});else Object.keys(this.items).forEach((E)=>{let[L,_]=T(this.items[E],Number(E));w[L]=_});return new this.constructor(w)}max(T){if(typeof T==="string"){let w=this.items.filter((E)=>E[T]!==void 0);return Math.max(...w.map((E)=>E[T]))}return Math.max(...this.items)}median(T){let{length:w}=this.items;if(T===void 0){if(w%2===0)return(this.items[w/2-1]+this.items[w/2])/2;return this.items[Math.floor(w/2)]}if(w%2===0)return(this.items[w/2-1][T]+this.items[w/2][T])/2;return this.items[Math.floor(w/2)][T]}merge(T){let w={...this.items,...T};return new H(w)}mergeRecursive(T){let w=(E,L)=>{let _={};return Object.keys({...E,...L}).forEach((U)=>{if(E[U]===void 0&&L[U]!==void 0)_[U]=L[U];else if(E[U]!==void 0&&L[U]===void 0)_[U]=E[U];else if(E[U]!==void 0&&L[U]!==void 0)if(E[U]===L[U])_[U]=E[U];else if(!Array.isArray(E[U])&&typeof E[U]==="object"&&!Array.isArray(L[U])&&typeof L[U]==="object")_[U]=w(E[U],L[U]);else _[U]=[].concat(E[U],L[U])}),_};if(!T)return this;if(T.constructor.name==="Collection")return new this.constructor(w(this.items,T.all()));return new this.constructor(w(this.items,T))}min(T){if(T!==void 0){let w=this.items.filter((E)=>E[T]!==void 0);return Math.min(...w.map((E)=>E[T]))}return Math.min(...this.items)}mode(T){let w=[],E=1;if(!this.items.length)return null;return this.items.forEach((L)=>{let _=w.filter((Q)=>{if(T!==void 0)return Q.key===L[T];return Q.key===L});if(!_.length)if(T!==void 0)w.push({key:L[T],count:1});else w.push({key:L,count:1});else{_[0].count+=1;let{count:Q}=_[0];if(Q>E)E=Q}}),w.filter((L)=>L.count===E).map((L)=>L.key)}nth(T,w=0){let L=D(this.items).slice(w).filter((_,Q)=>Q%T===0);return new this.constructor(L)}only(T){let w={};return T.forEach((E)=>{if(E in this.items)w[E]=this.items[E]}),new H(w)}pad(T,w){let E=Math.abs(T),L=this.count();if(E<=L)return this;let _=E-L,Q=x(this.items),U=Array.isArray(this.items),Y=T<0;for(let q=0;q<_;){if(!U)if(Q[q]!==void 0)_+=1;else Q[q]=w;else if(Y)Q.unshift(w);else Q.push(w);q+=1}return new this.constructor(Q)}partition(T){let w;if(Array.isArray(this.items))w=[new this.constructor([]),new this.constructor([])],this.items.forEach((E)=>{if(T(E)===!0)w[0].push(E);else w[1].push(E)});else w=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach((E)=>{let L=this.items[E];if(T(L)===!0)w[0].put(E,L);else w[1].put(E,L)});return new this.constructor(w)}pipe(T){return T(this)}pluck(T,w){if(T.includes("*")){let E=o(this.items),L=[];if(w!==void 0){let Y=new RegExp(`0.${w}`,"g"),q=`0.${w}`.split(".").length;Object.keys(E).forEach((J)=>{let $=J.match(Y);if($){let R=$[0];if(R.split(".").length===q)L.push(E[R])}})}let _=[],Q=new RegExp(`0.${T}`,"g"),U=`0.${T}`.split(".").length;if(Object.keys(E).forEach((Y)=>{let q=Y.match(Q);if(q){let J=q[0];if(J.split(".").length===U)_.push(E[J])}}),w!==void 0){let Y={};return this.items.forEach((q,J)=>{Y[L[J]||""]=_}),new this.constructor(Y)}return new this.constructor([_])}if(w!==void 0){let E={};return this.items.forEach((L)=>{if(G(L,T)!==void 0)E[L[w]||""]=G(L,T);else E[L[w]||""]=null}),new this.constructor(E)}return this.map((E)=>{if(G(E,T)!==void 0)return G(E,T);return null})}pop(T=1){if(this.isEmpty())return null;if(B(this.items)){if(T===1)return this.items.pop();return new this.constructor(this.items.splice(-T))}if(W(this.items)){let w=Object.keys(this.items);if(T===1){let _=w[w.length-1],Q=this.items[_];return P(this.items,_),Q}let E=w.slice(-T),L=E.reduce((_,Q)=>{return _[Q]=this.items[Q],_},{});return P(this.items,E),new this.constructor(L)}return null}prepend(T,w){if(w!==void 0)return this.put(w,T);return this.items.unshift(T),this}pull(T,w=null){if(Array.isArray(this.items)){let L=Number(T);if(Number.isNaN(L))return w;let _=this.items[L];return this.items.splice(L,1),_??w}let E=this.items[T];return delete this.items[T],E??w}push(...T){return this.items=[...this.items,...T],this}put(T,w){return this.items[T]=w,this}random(T=null){let w=D(this.items),E=new this.constructor(w).shuffle();if(T!==Number.parseInt(T,10))return E.first();return E.take(T)}reduce(T,w){let E=null;if(w!==void 0)E=w;if(Array.isArray(this.items))this.items.forEach((L)=>{E=T(E,L)});else Object.keys(this.items).forEach((L)=>{E=T(E,this.items[L],L)});return E}reject(T){return new this.constructor(this.items).filter((w)=>!T(w))}replace(T){if(!T)return this;if(Array.isArray(T)){let E=this.items.map((L,_)=>T[_]||L);return new this.constructor(E)}if(T.constructor.name==="Collection"){let E={...this.items,...T.all()};return new this.constructor(E)}let w={...this.items,...T};return new this.constructor(w)}replaceRecursive(T){let w=(E,L)=>{let _={...E};return Object.keys({...E,...L}).forEach((U)=>{if(!Array.isArray(L[U])&&typeof L[U]==="object")_[U]=w(E[U],L[U]);else if(E[U]===void 0&&L[U]!==void 0)if(typeof E[U]==="object")_[U]={...L[U]};else _[U]=L[U];else if(E[U]!==void 0&&L[U]===void 0)if(typeof E[U]==="object")_[U]={...E[U]};else _[U]=E[U];else if(E[U]!==void 0&&L[U]!==void 0)if(typeof L[U]==="object")_[U]={...L[U]};else _[U]=L[U]}),_};if(!T)return this;if(!Array.isArray(T)&&typeof T!=="object")return new this.constructor(w(this.items,[T]));if(T.constructor.name==="Collection")return new this.constructor(w(this.items,T.all()));return new this.constructor(w(this.items,T))}reverse(){let T=[].concat(this.items).reverse();return new this.constructor(T)}search(T,w){let E,L=(_,Q)=>{if(Z(T))return T(this.items[Q],Q);if(w)return this.items[Q]===T;return this.items[Q]==T};if(B(this.items))E=this.items.findIndex(L);else if(W(this.items))E=Object.keys(this.items).find((_)=>L(this.items[_],_));if(E===void 0||E<0)return!1;return E}shift(T=1){if(this.isEmpty())return null;if(B(this.items)){if(T===1)return this.items.shift();return new this.constructor(this.items.splice(0,T))}if(W(this.items)){if(T===1){let _=Object.keys(this.items)[0],Q=this.items[_];return delete this.items[_],Q}let E=Object.keys(this.items).slice(0,T),L=E.reduce((_,Q)=>{return _[Q]=this.items[Q],_},{});return P(this.items,E),new this.constructor(L)}return null}shuffle(){let T=D(this.items),w,E,L;for(L=T.length;L;L-=1)w=Math.floor(Math.random()*L),E=T[L-1],T[L-1]=T[w],T[w]=E;return this.items=T,this}skip(T){if(W(this.items))return new this.constructor(Object.keys(this.items).reduce((w,E,L)=>{if(L+1>T)w[E]=this.items[E];return w},{}));return new this.constructor(this.items.slice(T))}skipUntil(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!0)w=L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!0)w=L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}skipWhile(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!0)w=!L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!0)w=!L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}slice(T,w){let E=this.items.slice(T);if(w!==void 0)E=E.slice(0,w);return new this.constructor(E)}sole(){if(this.items.length!==1)throw new Error("Collection does not contain exactly one item.");return this.items[0]}some(T){return this.items.some((w)=>w.hasOwnProperty(T))}sort(T){let w=[].concat(this.items);if(T===void 0)if(this.every((E)=>typeof E==="number"))w.sort((E,L)=>E-L);else w.sort();else w.sort(T);return new this.constructor(w)}sortDesc(){return this.sort().reverse()}sortBy(T){let w=[].concat(this.items),E=(L)=>{if(Z(T))return T(L);return G(L,T)};return w.sort((L,_)=>{let Q=E(L),U=E(_);if(Q===null||Q===void 0)return 1;if(U===null||U===void 0)return-1;if(Q<U)return-1;if(Q>U)return 1;return 0}),new this.constructor(w)}sortByDesc(T){return this.sortBy(T).reverse()}sortKeys(){let T={};return Object.keys(this.items).sort().forEach((w)=>{T[w]=this.items[w]}),new this.constructor(T)}sortKeysDesc(){let T={};return Object.keys(this.items).sort().reverse().forEach((w)=>{T[w]=this.items[w]}),new this.constructor(T)}splice(T,w,E){let L=this.slice(T,w);if(this.items=this.diff(L.all()).all(),Array.isArray(E))for(let _=0,{length:Q}=E;_<Q;_+=1)this.items.splice(T+_,0,E[_]);return L}split(T){let w=this.toArray(),E=[],L=Math.ceil(w.length/T);for(let _=0;_<w.length;_+=L)E.push(w.slice(_,_+L));return new H(E)}sum(T){let w=D(this.items),E=0;if(T===void 0)for(let L=0,{length:_}=w;L<_;L+=1)E+=Number.parseFloat(w[L]);else if(Z(T))for(let L=0,{length:_}=w;L<_;L+=1)E+=Number.parseFloat(T(w[L]));else for(let L=0,{length:_}=w;L<_;L+=1)E+=Number.parseFloat(w[L][T]);return Number.parseFloat(E.toPrecision(12))}take(T){if(!Array.isArray(this.items)&&typeof this.items==="object"){let w=Object.keys(this.items),E;if(T<0)E=w.slice(T);else E=w.slice(0,T);let L={};return w.forEach((_)=>{if(E.includes(_))L[_]=this.items[_]}),new this.constructor(L)}if(T<0)return new this.constructor(this.items.slice(T));return new this.constructor(this.items.slice(0,T))}takeUntil(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!1)w=!L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!1)w=!L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}takeWhile(T){let w=null,E,L=(_)=>_===T;if(Z(T))L=T;if(B(this.items))E=this.items.filter((_)=>{if(w!==!1)w=L(_);return w});if(W(this.items))E=Object.keys(this.items).reduce((_,Q)=>{if(w!==!1)w=L(this.items[Q]);if(w!==!1)_[Q]=this.items[Q];return _},{});return new this.constructor(E)}tap(T){return T(this),this}times(T,w){for(let E=1;E<=T;E+=1)this.items.push(w(E));return this}toArray(){return Array.isArray(this.items)?this.items:Object.values(this.items)}toJson(){return JSON.stringify(this.items)}transform(T){if(Array.isArray(this.items))this.items=this.items.map(T);else{let w={};Object.keys(this.items).forEach((E)=>{w[E]=T(this.items[E],E)}),this.items=w}return this}undot(){if(Array.isArray(this.items))return this;let T={};return Object.keys(this.items).forEach((w)=>{if(w.includes(".")){let E=T;w.split(".").reduce((L,_,Q,U)=>{if(!L[_])L[_]={};if(Q===U.length-1)L[_]=this.items[w];return L[_]},E),T={...T,...E}}else T[w]=this.items[w]}),new this.constructor(T)}unless(T,w,E){if(!T)return w(this);if(E)return E();return}unlessEmpty(T){if(!this.isEmpty())T(this);return this}unlessNotEmpty(T){if(this.isEmpty())T(this);return this}union(T){let w=JSON.parse(JSON.stringify(this.items));return Object.keys(T).forEach((E)=>{if(this.items[E]===void 0)w[E]=T[E]}),new this.constructor(w)}unique(){let T=Array.from(new Set(this.items));return new this.constructor(T)}unwrap(){return this.items}values(){return new H(Object.values(this.items))}when(T,w,E){if(T)w(this,T);else if(E)E();return this}whenEmpty(T,w){if(Array.isArray(this.items)&&!this.items.length)return T(this);if(!Object.keys(this.items).length)return T(this);if(w!==void 0){if(Array.isArray(this.items)&&this.items.length)return w(this);if(Object.keys(this.items).length)return w(this)}return this}whenNotEmpty(T,w){if(Array.isArray(this.items)&&this.items.length)return T(this);if(Object.keys(this.items).length)return T(this);if(w!==void 0){if(Array.isArray(this.items)&&!this.items.length)return w(this);if(!Object.keys(this.items).length)return w(this)}return this}where(T,w,E){if(arguments.length===1)return new H(this.items.filter((_)=>_[T]!==void 0));if(arguments.length===2)E=w,w="===";let L=(_,Q,U,Y)=>{let q=_[Q];switch(Y){case"===":return q===U;case"!==":return q!==U;case"<":return q<U;case"<=":return q<=U;case">":return q>U;case">=":return q>=U;default:return q==U}};return new H(this.items.filter((_)=>L(_,T,E,w)))}whereBetween(T,w){return this.filter((E)=>{let L=typeof E==="object"?E[T]:E;return L>=w[0]&&L<=w[1]})}whereIn(T,w){return this.filter((E)=>{let L=typeof E==="object"?E[T]:E;return w.includes(L)})}whereNotBetween(T,w){return this.filter((E)=>{let L=typeof E==="object"?E[T]:E;return L<w[0]||L>w[1]})}whereNotIn(T,w){let E=this.items.filter((L)=>{let _=T.split("."),Q=L;for(let U of _){if(Q[U]===void 0)return!0;Q=Q[U]}return!w.includes(Q)});return new H(E)}getNestedValue(T,w){return w.split(".").reduce((L,_)=>L&&L[_]!==void 0?L[_]:null,T)}whereInstanceOf(T){return this.filter((w)=>w instanceof T)}whereNotNull(T){return this.where(T,"!==",null)}whereNull(T){return this.where(T,"===",null)}static wrap(T){if(T instanceof H)return T;return new H(Array.isArray(T)?T:[T])}static unwrap(T){if(T instanceof H)return T.all();return T}wrap(T){if(T instanceof H)return T;if(typeof T==="object")return new H(T);return new H([T])}zip(...T){let w=T.map((L)=>this.constructor.wrap(L).all()),E=this.items.map((L,_)=>{let Q=[L];return w.forEach((U)=>{Q.push(U[_])}),new this.constructor(Q)});return new this.constructor(E)}}var o=function T(w){let E={};return w.forEach((L,_)=>{function Q(U,Y){if(W(U))Object.keys(U).forEach((q)=>{Q(U[q],`${Y}.${q}`)});else if(B(U))U.forEach((q,J)=>{Q(q,`${Y}.${J}`)});E[Y]=U}Q(L,_)}),E};function y(){let T=-1;return{next:()=>{return T+=1,{value:this.items[T],done:T>=this.items.length}}}}var LT=n;export{LT as default,n as collect,H as Collection};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/collections",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.67.0",
|
|
5
5
|
"description": "The Stacks collections.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
@@ -27,17 +27,15 @@
|
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
-
"bun": "./src/index.ts",
|
|
31
30
|
"import": "./dist/index.js"
|
|
32
31
|
},
|
|
33
32
|
"./*": {
|
|
34
|
-
"bun": "./src/*",
|
|
35
33
|
"import": "./dist/*"
|
|
36
34
|
}
|
|
37
35
|
},
|
|
38
36
|
"module": "dist/index.js",
|
|
39
37
|
"types": "dist/index.d.ts",
|
|
40
|
-
"files": ["README.md", "dist"
|
|
38
|
+
"files": ["README.md", "dist"],
|
|
41
39
|
"scripts": {
|
|
42
40
|
"build": "bun build.ts",
|
|
43
41
|
"typecheck": "bun tsc --noEmit",
|
|
@@ -48,6 +46,6 @@
|
|
|
48
46
|
"collect.js": "^4.36.1"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@stacksjs/development": "0.
|
|
49
|
+
"@stacksjs/development": "0.67.0"
|
|
52
50
|
}
|
|
53
51
|
}
|
package/dist/index.js.map
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["node:process", "../src/helpers/clone.ts", "../src/helpers/variadic.ts", "../src/helpers/delete-keys.ts", "../src/helpers/is.ts", "../src/helpers/nested-value.ts", "../src/helpers/values.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"var C=Object.create;var T=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),N=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,w)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let l of A(t))!Q.call(e,l)&&l!==n&&T(e,l,{get:()=>t[l],enumerable:!(w=q(t,l))||w.enumerable});return e},h=(e,t,n)=>(d(e,t,\"default\"),n&&d(n,t,\"default\")),y=(e,t,n)=>(n=e!=null?C(I(e)):{},d(t||!e||!e.__esModule?T(n,\"default\",{value:e,enumerable:!0}):n,e));var v=S((B,E)=>{var r=E.exports={},i,u;function p(){throw new Error(\"setTimeout has not been defined\")}function g(){throw new Error(\"clearTimeout has not been defined\")}(function(){try{typeof setTimeout==\"function\"?i=setTimeout:i=p}catch{i=p}try{typeof clearTimeout==\"function\"?u=clearTimeout:u=g}catch{u=g}})();function b(e){if(i===setTimeout)return setTimeout(e,0);if((i===p||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch{try{return i.call(null,e,0)}catch{return i.call(this,e,0)}}}function O(e){if(u===clearTimeout)return clearTimeout(e);if((u===g||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch{try{return u.call(null,e)}catch{return u.call(this,e)}}}var o=[],s=!1,a,m=-1;function U(){!s||!a||(s=!1,a.length?o=a.concat(o):m=-1,o.length&&x())}function x(){if(!s){var e=b(U);s=!0;for(var t=o.length;t;){for(a=o,o=[];++m<t;)a&&a[m].run();m=-1,t=o.length}a=null,s=!1,O(e)}}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];o.push(new L(e,t)),o.length===1&&!s&&b(x)};function L(e,t){this.fun=e,this.array=t}L.prototype.run=function(){this.fun.apply(null,this.array)};r.title=\"browser\";r.browser=!0;r.env={};r.argv=[];r.version=\"\";r.versions={};function c(){}r.on=c;r.addListener=c;r.once=c;r.off=c;r.removeListener=c;r.removeAllListeners=c;r.emit=c;r.prependListener=c;r.prependOnceListener=c;r.listeners=function(e){return[]};r.binding=function(e){throw new Error(\"process.binding is not supported\")};r.cwd=function(){return\"/\"};r.chdir=function(e){throw new Error(\"process.chdir is not supported\")};r.umask=function(){return 0}});var f={};N(f,{default:()=>j});h(f,y(v()));var j=y(v());export{j as default};\n",
|
|
6
|
-
"/**\n * Clone helper\n *\n * Clone an array or object\n *\n * @param items - The array or object to clone\n * @returns A deep clone of the input\n */\nexport function clone<T>(items: T[]): T[]\nexport function clone<T extends object>(items: T): T\nexport function clone<T>(items: T[] | T): T[] | T {\n if (Array.isArray(items)) {\n return [...items]\n }\n\n return { ...items }\n}\n",
|
|
7
|
-
"/**\n * Variadic helper function\n *\n * @param args - The arguments to process\n * @returns An array of the processed arguments\n */\nexport function variadic<T>(args: T[] | T): T[] {\n if (Array.isArray(args)) {\n return args\n }\n\n return [args]\n}\n",
|
|
8
|
-
"import { variadic } from './variadic'\n\n/**\n * Delete keys helper\n *\n * Delete one or multiple keys from an object\n *\n * @param obj - The object from which to delete keys\n * @param keys - The keys to delete\n * @returns {void}\n */\nexport function deleteKeys<T extends object>(obj: T, ...keys: (keyof T)[]): void {\n variadic(keys).forEach((key) => {\n delete obj[key]\n })\n}\n",
|
|
9
|
-
"/**\n * Checks if the item is an array.\n * @param item - The item to check.\n * @returns A boolean indicating whether the item is an array.\n */\nexport const isArray = (item: unknown): item is Array<unknown> => Array.isArray(item)\n\n/**\n * Checks if the item is an object (excluding arrays and null).\n * @param item - The item to check.\n * @returns A boolean indicating whether the item is an object.\n */\nexport function isObject(item: unknown): item is object {\n return typeof item === 'object' && !Array.isArray(item) && item !== null\n}\n\n/**\n * Checks if the item is a function.\n * @param item - The item to check.\n * @returns A boolean indicating whether the item is a function.\n */\n// eslint-disable-next-line ts/no-unsafe-function-type\nexport const isFunction = (item: unknown): item is Function => typeof item === 'function'\n",
|
|
10
|
-
"/**\n * Get value of a nested property\n *\n * @param mainObject - The object to search for the nested property\n * @param key - The key path to the nested property, using dot notation\n * @returns The value of the nested property, or the mainObject if not found\n */\nexport function nestedValue<T>(mainObject: T, key: string): any {\n try {\n return key.split('.').reduce((obj: any, property: string) => obj[property], mainObject)\n }\n // eslint-disable-next-line unused-imports/no-unused-vars\n catch (err) {\n // If we end up here, we're not working with an object, and mainObject is the value itself\n return mainObject\n }\n}\n",
|
|
11
|
-
"/**\n * Values helper\n *\n * Retrieve values from items when it is an array, object or Collection\n *\n * @param items - The input array, object, or Collection\n * @returns An array of values\n */\nexport function values<T>(items: T[] | { [key: string]: T } | { all: () => T[] }): T[] {\n if (Array.isArray(items)) {\n return [...items]\n }\n\n if ('all' in items && typeof items.all === 'function') {\n return items.all()\n }\n\n return Object.values(items)\n}\n",
|
|
12
|
-
"/* eslint-disable ts/no-unsafe-function-type,eqeqeq,ts/no-use-before-define,unused-imports/no-unused-vars,no-prototype-builtins, no-console */\nimport process from 'node:process'\nimport { clone, deleteKeys, isArray, isFunction, isObject, nestedValue, values } from './helpers/'\n\ntype IsArray<T> = T extends any[] ? true : false\ntype CollectionAll<T> = IsArray<T> extends true ? T : { [K in keyof T]: T[K] }\n\nexport function collect<T extends object | string | number | boolean>(items: T): Collection<T> {\n return new Collection(items)\n}\n\nexport class Collection<T> {\n protected items: T[] | Record<string, T>\n\n constructor(items: T[] | Record<string | number | symbol, T> = []) {\n this.items = items\n }\n\n [Symbol.iterator] = SymbolIterator\n\n toJSON(): T[] {\n return this.items as T[]\n }\n\n all(): CollectionAll<T> {\n return this.items as CollectionAll<T>\n }\n\n average(key?: string | ((item: T) => number)): number {\n if (key === undefined) {\n return this.sum() / Number(this.items.length)\n }\n\n if (isFunction(key)) {\n return (\n Number(new (this.constructor as new (items: typeof this.items) => typeof this)(this.items).sum(key))\n / Number(this.items.length)\n )\n }\n\n return (\n Number(new (this.constructor as new (items: typeof this.items) => typeof this)(this.items).pluck(key).sum())\n / Number(this.items.length)\n )\n }\n\n avg: typeof this.average = this.average\n\n chunk(size: number): Collection<T[]> {\n const chunks = []\n const items = Array.isArray(this.items) ? this.items : Object.values(this.items)\n\n for (let i = 0; i < items.length; i += size) {\n chunks.push(items.slice(i, i + size))\n }\n\n return new Collection(chunks)\n }\n\n collapse(): Collection<T extends any[] ? T[number] : T> {\n return new (this.constructor as any)(([] as T[]).concat(...(this.items as any[])))\n }\n\n combine(values: any): Collection<T> {\n if (typeof values === 'string') {\n values = [values]\n }\n\n if (!Array.isArray(values)) {\n throw new TypeError('The values must be an array or a string')\n }\n\n const collection = {}\n const keys = Array.isArray(this.items) ? this.items : Object.keys(this.items)\n\n keys.forEach((key, index) => {\n if (values[index] !== undefined) {\n collection[key] = values[index]\n }\n })\n\n return new Collection(collection)\n }\n\n concat(collectionOrArrayOrObject: Collection<T> | T[] | object): Collection<T> {\n let list = collectionOrArrayOrObject\n\n if (collectionOrArrayOrObject instanceof this.constructor) {\n list = collectionOrArrayOrObject.all()\n }\n else if (typeof collectionOrArrayOrObject === 'object') {\n list = []\n Object.keys(collectionOrArrayOrObject).forEach((property) => {\n list.push(collectionOrArrayOrObject[property])\n })\n }\n\n const collection = clone(this.items)\n\n list.forEach((item) => {\n if (typeof item === 'object') {\n Object.keys(item).forEach(key => collection.push(item[key]))\n }\n else {\n collection.push(item)\n }\n })\n\n return new this.constructor(collection)\n }\n\n contains(key: T extends (infer U)[] ? U : T | string | ((item: T, index: number) => boolean), value?: any): boolean {\n if (typeof key === 'function') {\n return this.items.some(key as (item: T, index: number) => boolean)\n }\n\n if (Array.isArray(this.items)) {\n return (this.items as any[]).includes(key as any)\n }\n\n if (value !== undefined) {\n if (Array.isArray(this.items)) {\n return this.items.some(item => item[key as keyof T] !== undefined && item[key as keyof T] === value)\n }\n\n return (\n (key as string | number | symbol) in this.items\n && (this.items as Record<keyof T, any>)[key as keyof T] === value\n )\n }\n\n if (Array.isArray(this.items)) {\n return this.items.includes(key as T extends (infer U)[] ? U : never)\n }\n\n return Object.values(this.items).includes(key as T extends object ? T[keyof T] : never)\n }\n\n containsOneItem(): boolean {\n if (typeof this.items === 'string') {\n return true\n }\n\n return Object.keys(this.items).length === 1\n }\n\n count(predicate?: (item: T) => boolean): number {\n if (predicate) {\n return this.filter(predicate).count()\n }\n\n return Object.keys(this.items).length\n }\n\n countBy(callback?: (item: T) => string | number): Collection<number> {\n const counts: Record<string | number, number> = {}\n this.each((item) => {\n const key = callback ? callback(item) : item\n counts[key] = (counts[key] || 0) + 1\n })\n return new Collection(counts)\n }\n\n crossJoin(...values: T[]): Collection<T> {\n function join(collection: T[], constructor: new (items: T[]) => Collection<T>, args: T[]): T[] {\n let current = args[0]\n\n if (current instanceof Collection) {\n current = current.all()\n }\n\n const rest = args.slice(1)\n const last = !rest.length\n let result = []\n\n for (let i = 0; i < current.length; i += 1) {\n const collectionCopy = collection.slice()\n collectionCopy.push(current[i])\n\n if (last) {\n result.push(collectionCopy)\n }\n else {\n result = result.concat(join(collectionCopy, constructor, rest))\n }\n }\n\n return result\n }\n\n return new this.constructor(join([], this.constructor, [].concat([this.items], values)))\n }\n\n dd(): void {\n console.log(JSON.stringify(this.all(), null, 2))\n process.exit()\n }\n\n diff(values: Collection<T> | T[]): Collection<T> {\n let valuesToDiff\n\n if (values instanceof this.constructor) {\n valuesToDiff = values.all()\n }\n else {\n valuesToDiff = values\n }\n\n const collection = this.items.filter(item => !valuesToDiff.includes(item))\n\n return new this.constructor(collection)\n }\n\n diffAssoc(values: Collection<T> | T[]): Collection<T> {\n let diffValues = values\n\n if (values instanceof this.constructor) {\n diffValues = values.all()\n }\n\n const collection = {}\n\n Object.keys(this.items).forEach((key) => {\n if (diffValues[key] === undefined || diffValues[key] !== this.items[key]) {\n collection[key] = this.items[key]\n }\n })\n\n return new this.constructor(collection)\n }\n\n diffKeys(object: Collection<T> | T[]): Collection<T> {\n let objectToDiff\n\n if (object instanceof this.constructor) {\n objectToDiff = object.all()\n }\n else {\n objectToDiff = object\n }\n\n const objectKeys = Object.keys(objectToDiff)\n\n const remainingKeys = Object.keys(this.items).filter(item => !objectKeys.includes(item))\n\n return new this.constructor(this.items).only(remainingKeys)\n }\n\n diffUsing(array: any[] | null, callback: (a: any, b: any) => number): Collection<T> {\n console.log('Original collection:', this.items)\n\n console.log('Array to compare:', array)\n\n if (array === null) {\n // If the input array is null, return a copy of the original collection\n return new Collection(this.items)\n }\n\n const collection = this.items.filter((item) => {\n const index = array.findIndex((otherItem) => {\n return callback(item, otherItem) === 0\n })\n\n return index === -1\n })\n\n return new Collection(collection)\n }\n\n doesntContain(key: string | number | symbol | ((item: T, index: number) => boolean), value?: any): boolean {\n console.log('doesntContain called with:', { key, value })\n\n if (typeof key === 'function') {\n console.log('Function branch')\n return !this.contains(key)\n }\n\n if (value !== undefined) {\n console.log('Key-value pair branch')\n return !this.contains((item) => {\n console.log('Comparing:', item[key], 'with', value)\n return item[key] === value\n })\n }\n\n console.log('Single value branch')\n return !this.contains(key)\n }\n\n dump(): this {\n console.log(this.items)\n return this\n }\n\n duplicates(): Collection<T> {\n const occuredValues = []\n const duplicateValues = {}\n\n const stringifiedValue = (value: any): string => {\n if (Array.isArray(value) || typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n return value\n }\n\n if (Array.isArray(this.items)) {\n this.items.forEach((value, index) => {\n const valueAsString = stringifiedValue(value)\n\n if (!occuredValues.includes(valueAsString)) {\n occuredValues.push(valueAsString)\n }\n else {\n duplicateValues[index] = value\n }\n })\n }\n else if (typeof this.items === 'object') {\n Object.keys(this.items).forEach((key) => {\n const valueAsString = stringifiedValue(this.items[key])\n\n if (!occuredValues.includes(valueAsString)) {\n occuredValues.push(valueAsString)\n }\n else {\n duplicateValues[key] = this.items[key]\n }\n })\n }\n\n return new this.constructor(duplicateValues)\n }\n\n each(fn: (item: T, index: number | string, items: T[]) => boolean | void): Collection<T> {\n let stop = false\n\n if (Array.isArray(this.items)) {\n const { length } = this.items\n\n for (let index = 0; index < length && !stop; index += 1) {\n stop = fn(this.items[index], index, this.items) === false\n }\n }\n else {\n const keys = Object.keys(this.items)\n const { length } = keys\n\n for (let index = 0; index < length && !stop; index += 1) {\n const key = keys[index]\n\n stop = fn(this.items[key], key, this.items) === false\n }\n }\n\n return this\n }\n\n eachSpread(fn: (...args: any[]) => void): Collection<T> {\n this.each((values: any, key: any) => {\n fn(...values, key)\n })\n\n return this\n }\n\n every(fn: (value: T, key: string | number, collection: T[]) => boolean): boolean {\n const items = values(this.items)\n\n return items.every(fn)\n }\n\n except(keys: string | string[]): Collection<T> {\n const result = { ...this.items }\n const keysArray = Array.isArray(keys) ? keys : [keys]\n keysArray.forEach(key => delete result[key])\n return new Collection(result)\n }\n\n filter(callback?: (item: T, index: number) => boolean): Collection<T> {\n console.log('Filter method called with callback:', callback)\n\n console.log('Current items:', this.items)\n\n if (typeof callback !== 'function') {\n console.log('No callback provided, removing falsy values')\n const filteredItems = this.items.filter((item) => {\n console.log('Filtering item:', item)\n return Boolean(item)\n })\n\n console.log('Filtered items:', filteredItems)\n return new Collection(filteredItems)\n }\n\n const filteredItems = this.items.filter((item, index) => {\n console.log('Filtering item:', item, 'at index:', index)\n return callback(item, index)\n })\n\n console.log('Filtered items:', filteredItems)\n return new Collection(filteredItems)\n }\n\n first(\n fn?: (value: T, key: string | number, collection?: T[]) => boolean,\n defaultValue?: T | (() => T),\n ): T | undefined {\n if (isFunction(fn)) {\n const keys = Object.keys(this.items)\n\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i]\n const item = this.items[key]\n\n if (fn(item, key)) {\n return item\n }\n }\n\n if (isFunction(defaultValue)) {\n return defaultValue()\n }\n\n return defaultValue\n }\n\n if ((Array.isArray(this.items) && this.items.length) || Object.keys(this.items).length) {\n if (Array.isArray(this.items)) {\n return this.items[0]\n }\n\n const firstKey = Object.keys(this.items)[0]\n\n return this.items[firstKey]\n }\n\n if (isFunction(defaultValue)) {\n return defaultValue()\n }\n\n return defaultValue\n }\n\n firstOrFail(callback?: (item: T) => boolean): T {\n const found = this.items.find(callback || (() => true))\n if (found === undefined) {\n throw new Error('Item not found.')\n }\n return found\n }\n\n firstWhere(key: string, operator: string, value: any): T | null {\n return this.where(key, operator, value).first() || null\n }\n\n flatMap(fn: (item: T, key: string | number) => any): Collection<any> {\n return this.map(fn).collapse()\n }\n\n flatten(depth: number = Number.POSITIVE_INFINITY): Collection<T> {\n const flatten = (item: any, d: number): any[] => {\n if (!Array.isArray(item) && typeof item !== 'object') {\n return [item]\n }\n return d > 0\n ? Object.values(item).reduce(\n (acc, val) => acc.concat(Array.isArray(val) || typeof val === 'object' ? flatten(val, d - 1) : val),\n [],\n )\n : Array.isArray(item)\n ? [...item]\n : [item]\n }\n\n return new Collection(flatten(this.items, depth))\n }\n\n flip(): Collection<T> {\n const flipped = {}\n if (Array.isArray(this.items)) {\n this.items.forEach((value, index) => {\n flipped[value] = index\n })\n }\n else {\n Object.entries(this.items).forEach(([key, value]) => {\n flipped[value] = key\n })\n }\n return new this.constructor(flipped)\n }\n\n forPage(page: number, chunk: number): Collection<T> {\n let collection = {}\n\n if (Array.isArray(this.items)) {\n collection = this.items.slice(page * chunk - chunk, page * chunk)\n }\n else {\n Object.keys(this.items)\n .slice(page * chunk - chunk, page * chunk)\n .forEach((key) => {\n collection[key] = this.items[key]\n })\n }\n\n return new this.constructor(collection)\n }\n\n forget(key: string): Collection<T> {\n if (Array.isArray(this.items)) {\n this.items = this.items.filter((item, index) => index !== Number.parseInt(key, 10))\n }\n else if (typeof this.items === 'object' && this.items !== null) {\n delete this.items[key]\n }\n\n return this\n }\n\n get(key: string | number, defaultValue: T | null = null): T | null {\n if (Array.isArray(this.items)) {\n return this.items[key as number] ?? defaultValue\n }\n\n return (this.items as Record<string, T>)[key as string] ?? defaultValue\n }\n\n groupBy(fn: ((item: T) => any) | string): Collection<Collection<T>> {\n const groups = {}\n this.each((item, key) => {\n const groupKey = typeof fn === 'function' ? fn(item) : item[fn]\n if (!(groupKey in groups)) {\n groups[groupKey] = new Collection()\n }\n groups[groupKey].push(item)\n })\n\n return new Collection(groups)\n }\n\n has(key: string | number): boolean {\n if (Array.isArray(this.items)) {\n return key in this.items\n }\n\n return key in (this.items as Record<string, T>)\n }\n\n implode(key: string, glue?: string): string {\n if (glue === undefined) {\n return this.items.join(key)\n }\n\n return new this.constructor(this.items).pluck(key).all().join(glue)\n }\n\n includes(key: T | T[keyof T]): boolean {\n if (Array.isArray(this.items)) {\n return this.items.includes(key as T)\n }\n\n return Object.values(this.items).includes(key)\n }\n\n intersect(values: Collection<T> | T[]): Collection<T> {\n let intersectValues = values\n\n if (values instanceof this.constructor) {\n intersectValues = values.all()\n }\n\n const collection = this.items.filter(item => intersectValues.includes(item))\n\n return new this.constructor(collection)\n }\n\n intersectByKeys(values: Collection<T> | T[]): Collection<T> {\n let intersectKeys = Object.keys(values)\n\n if (values instanceof this.constructor) {\n intersectKeys = Object.keys(values.all())\n }\n\n const collection = {}\n\n Object.keys(this.items).forEach((key) => {\n if (intersectKeys.includes(key)) {\n collection[key] = this.items[key]\n }\n })\n\n return new this.constructor(collection)\n }\n\n isEmpty(): boolean {\n return this.count() === 0\n }\n\n isNotEmpty(): boolean {\n return !this.isEmpty()\n }\n\n join(glue: string, finalGlue?: string): string {\n const collection = this.values()\n\n if (finalGlue === undefined) {\n return collection.implode(glue)\n }\n\n const count = collection.count()\n\n if (count === 0) {\n return ''\n }\n\n if (count === 1) {\n return collection.last()\n }\n\n const finalItem = collection.pop()\n\n return collection.implode(glue) + finalGlue + finalItem\n }\n\n keyBy(key: string | ((item: T) => string)): Collection<T> {\n const collection = {}\n\n if (isFunction(key)) {\n this.items.forEach((item) => {\n collection[key(item)] = item\n })\n }\n else {\n this.items.forEach((item) => {\n const keyValue = nestedValue(item, key)\n\n collection[keyValue || ''] = item\n })\n }\n\n return new this.constructor(collection)\n }\n\n keys(): Collection<string> {\n return new Collection(Object.keys(this.items))\n }\n\n last(fn?: (item: T) => boolean, defaultValue?: T | (() => T)): T {\n let { items } = this\n\n if (isFunction(fn)) {\n items = this.filter(fn).all()\n }\n\n if ((Array.isArray(items) && !items.length) || !Object.keys(items).length) {\n if (isFunction(defaultValue)) {\n return defaultValue()\n }\n\n return defaultValue\n }\n\n if (Array.isArray(items)) {\n return items[items.length - 1]\n }\n const keys = Object.keys(items)\n\n return items[keys[keys.length - 1]]\n }\n\n macro(name: string, fn: Function): void {\n this.constructor.prototype[name] = fn\n }\n\n make(items: T[] = []): Collection<T> {\n return new this.constructor(items)\n }\n\n map(fn: (item: T, index: number) => any): Collection<any> {\n if (Array.isArray(this.items)) {\n return new this.constructor(this.items.map(fn))\n }\n\n const collection = {}\n\n Object.keys(this.items).forEach((key) => {\n collection[key] = fn(this.items[key], Number(key))\n })\n\n return new this.constructor(collection)\n }\n\n mapSpread(fn: (...args: any[]) => any): Collection<any> {\n return this.map((values, key) => fn(...values, key))\n }\n\n mapToDictionary(fn: (item: T, key: number) => [string, any]): Collection<any[]> {\n const collection = {}\n\n this.items.forEach((item, k) => {\n const [key, value] = fn(item, k)\n\n if (collection[key] === undefined) {\n collection[key] = [value]\n }\n else {\n collection[key].push(value)\n }\n })\n\n return new this.constructor(collection)\n }\n\n mapInto(ClassName: new (value: T, key: number | string) => any): Collection<any> {\n return this.map((value, key) => new ClassName(value, key))\n }\n\n mapToGroups(fn: (item: T, key: number) => [string, any]): Collection<any[]> {\n const collection = {}\n\n this.items.forEach((item, key) => {\n const [keyed, value] = fn(item, key)\n\n if (collection[keyed] === undefined) {\n collection[keyed] = [value]\n }\n else {\n collection[keyed].push(value)\n }\n })\n\n return new this.constructor(collection)\n }\n\n mapWithKeys(fn: (item: T, index: number) => [string, any]): Collection<any> {\n const collection = {}\n\n if (Array.isArray(this.items)) {\n this.items.forEach((item, index) => {\n const [keyed, value] = fn(item, index)\n collection[keyed] = value\n })\n }\n else {\n Object.keys(this.items).forEach((key) => {\n const [keyed, value] = fn(this.items[key], Number(key))\n collection[keyed] = value\n })\n }\n\n return new this.constructor(collection)\n }\n\n max(key?: string): number {\n if (typeof key === 'string') {\n const filtered = this.items.filter(item => item[key] !== undefined)\n\n return Math.max(...filtered.map(item => item[key]))\n }\n\n return Math.max(...this.items)\n }\n\n median(key?: string): number {\n const { length } = this.items\n\n if (key === undefined) {\n if (length % 2 === 0) {\n return (this.items[length / 2 - 1] + this.items[length / 2]) / 2\n }\n\n return this.items[Math.floor(length / 2)]\n }\n\n if (length % 2 === 0) {\n return (this.items[length / 2 - 1][key] + this.items[length / 2][key]) / 2\n }\n\n return this.items[Math.floor(length / 2)][key]\n }\n\n merge(object: object): Collection<T> {\n const merged = { ...this.items, ...object }\n\n return new Collection(merged)\n }\n\n mergeRecursive(items: T | T[] | Collection<T>): Collection<T> {\n const merge = (target: any, source: any): any => {\n const merged = {}\n\n const mergedKeys = Object.keys({ ...target, ...source })\n\n mergedKeys.forEach((key) => {\n if (target[key] === undefined && source[key] !== undefined) {\n merged[key] = source[key]\n }\n else if (target[key] !== undefined && source[key] === undefined) {\n merged[key] = target[key]\n }\n else if (target[key] !== undefined && source[key] !== undefined) {\n if (target[key] === source[key]) {\n merged[key] = target[key]\n }\n else if (\n !Array.isArray(target[key])\n && typeof target[key] === 'object'\n && !Array.isArray(source[key])\n && typeof source[key] === 'object'\n ) {\n merged[key] = merge(target[key], source[key])\n }\n else {\n merged[key] = [].concat(target[key], source[key])\n }\n }\n })\n\n return merged\n }\n\n if (!items) {\n return this\n }\n\n if (items.constructor.name === 'Collection') {\n return new this.constructor(merge(this.items, items.all()))\n }\n\n return new this.constructor(merge(this.items, items))\n }\n\n min(key?: string): number {\n if (key !== undefined) {\n const filtered = this.items.filter(item => item[key] !== undefined)\n\n return Math.min(...filtered.map(item => item[key]))\n }\n\n return Math.min(...this.items)\n }\n\n mode(key?: string): any[] {\n const values = []\n let highestCount = 1\n\n if (!this.items.length) {\n return null\n }\n\n this.items.forEach((item) => {\n const tempValues = values.filter((value) => {\n if (key !== undefined) {\n return value.key === item[key]\n }\n\n return value.key === item\n })\n\n if (!tempValues.length) {\n if (key !== undefined) {\n values.push({ key: item[key], count: 1 })\n }\n else {\n values.push({ key: item, count: 1 })\n }\n }\n else {\n tempValues[0].count += 1\n const { count } = tempValues[0]\n\n if (count > highestCount) {\n highestCount = count\n }\n }\n })\n\n return values.filter(value => value.count === highestCount).map(value => value.key)\n }\n\n nth(n: number, offset = 0): Collection<T> {\n const items = values(this.items)\n\n const collection = items.slice(offset).filter((item, index) => index % n === 0)\n\n return new this.constructor(collection)\n }\n\n only(keys: string[]): Collection<T> {\n const result = {}\n keys.forEach((key) => {\n if (key in this.items)\n result[key] = this.items[key]\n })\n return new Collection(result)\n }\n\n pad(size: number, value: T): Collection<T> {\n const abs = Math.abs(size)\n const count = this.count()\n\n if (abs <= count) {\n return this\n }\n\n let diff = abs - count\n const items = clone(this.items)\n const isArray = Array.isArray(this.items)\n const prepend = size < 0\n\n for (let iterator = 0; iterator < diff;) {\n if (!isArray) {\n if (items[iterator] !== undefined) {\n diff += 1\n }\n else {\n items[iterator] = value\n }\n }\n else if (prepend) {\n items.unshift(value)\n }\n else {\n items.push(value)\n }\n\n iterator += 1\n }\n\n return new this.constructor(items)\n }\n\n partition(fn: (item: T) => boolean): [Collection<T>, Collection<T>] {\n let arrays\n\n if (Array.isArray(this.items)) {\n arrays = [new this.constructor([]), new this.constructor([])]\n\n this.items.forEach((item) => {\n if (fn(item) === true) {\n arrays[0].push(item)\n }\n else {\n arrays[1].push(item)\n }\n })\n }\n else {\n arrays = [new this.constructor({}), new this.constructor({})]\n\n Object.keys(this.items).forEach((prop) => {\n const value = this.items[prop]\n\n if (fn(value) === true) {\n arrays[0].put(prop, value)\n }\n else {\n arrays[1].put(prop, value)\n }\n })\n }\n\n return new this.constructor(arrays)\n }\n\n pipe(fn) {\n return fn(this)\n }\n\n pluck(value: string, key?: string) {\n if (value.includes('*')) {\n const keyPathMap = buildKeyPathMap(this.items)\n const keyMatches = []\n\n if (key !== undefined) {\n const keyRegex = new RegExp(`0.${key}`, 'g')\n const keyNumberOfLevels = `0.${key}`.split('.').length\n\n Object.keys(keyPathMap).forEach((k) => {\n const matchingKey = k.match(keyRegex)\n\n if (matchingKey) {\n const match = matchingKey[0]\n\n if (match.split('.').length === keyNumberOfLevels) {\n keyMatches.push(keyPathMap[match])\n }\n }\n })\n }\n\n const valueMatches = []\n const valueRegex = new RegExp(`0.${value}`, 'g')\n const valueNumberOfLevels = `0.${value}`.split('.').length\n\n Object.keys(keyPathMap).forEach((k) => {\n const matchingValue = k.match(valueRegex)\n\n if (matchingValue) {\n const match = matchingValue[0]\n\n if (match.split('.').length === valueNumberOfLevels) {\n valueMatches.push(keyPathMap[match])\n }\n }\n })\n\n if (key !== undefined) {\n const collection = {}\n\n this.items.forEach((item, index) => {\n collection[keyMatches[index] || ''] = valueMatches\n })\n\n return new this.constructor(collection)\n }\n\n return new this.constructor([valueMatches])\n }\n\n if (key !== undefined) {\n const collection = {}\n\n this.items.forEach((item) => {\n if (nestedValue(item, value) !== undefined) {\n collection[item[key] || ''] = nestedValue(item, value)\n }\n else {\n collection[item[key] || ''] = null\n }\n })\n\n return new this.constructor(collection)\n }\n\n return this.map((item) => {\n if (nestedValue(item, value) !== undefined) {\n return nestedValue(item, value)\n }\n\n return null\n })\n }\n\n pop(count = 1) {\n if (this.isEmpty()) {\n return null\n }\n\n if (isArray(this.items)) {\n if (count === 1) {\n return this.items.pop()\n }\n\n return new this.constructor(this.items.splice(-count))\n }\n\n if (isObject(this.items)) {\n const keys = Object.keys(this.items)\n\n if (count === 1) {\n const key = keys[keys.length - 1]\n const last = this.items[key]\n\n deleteKeys(this.items, key)\n\n return last\n }\n\n const poppedKeys = keys.slice(-count)\n\n const newObject = poppedKeys.reduce((acc, current) => {\n acc[current] = this.items[current]\n\n return acc\n }, {})\n\n deleteKeys(this.items, poppedKeys)\n\n return new this.constructor(newObject)\n }\n\n return null\n }\n\n prepend(value, key) {\n if (key !== undefined) {\n return this.put(key, value)\n }\n\n this.items.unshift(value)\n\n return this\n }\n\n pull(key: string | number, defaultValue: T | null = null): T | null {\n if (Array.isArray(this.items)) {\n const index = Number(key)\n if (Number.isNaN(index))\n return defaultValue\n const value = this.items[index]\n this.items.splice(index, 1)\n return value ?? defaultValue\n }\n\n const value = this.items[key as string]\n delete this.items[key as string]\n return value ?? defaultValue\n }\n\n push(...items: T[]): Collection<T> {\n this.items = [...this.items, ...items]\n return this\n }\n\n put(key: string, value: any): this {\n this.items[key] = value\n return this\n }\n\n random(length = null) {\n const items = values(this.items)\n\n const collection = new this.constructor(items).shuffle()\n\n // If not a length was specified\n if (length !== Number.parseInt(length, 10)) {\n return collection.first()\n }\n\n return collection.take(length)\n }\n\n reduce(fn, carry) {\n let reduceCarry = null\n\n if (carry !== undefined) {\n reduceCarry = carry\n }\n\n if (Array.isArray(this.items)) {\n this.items.forEach((item) => {\n reduceCarry = fn(reduceCarry, item)\n })\n }\n else {\n Object.keys(this.items).forEach((key) => {\n reduceCarry = fn(reduceCarry, this.items[key], key)\n })\n }\n\n return reduceCarry\n }\n\n reject(fn) {\n return new this.constructor(this.items).filter(item => !fn(item))\n }\n\n replace(items) {\n if (!items) {\n return this\n }\n\n if (Array.isArray(items)) {\n const replaced = this.items.map((value, index) => items[index] || value)\n\n return new this.constructor(replaced)\n }\n\n if (items.constructor.name === 'Collection') {\n const replaced = { ...this.items, ...items.all() }\n\n return new this.constructor(replaced)\n }\n\n const replaced = { ...this.items, ...items }\n\n return new this.constructor(replaced)\n }\n\n replaceRecursive(items) {\n const replace = (target, source) => {\n const replaced = { ...target }\n\n const mergedKeys = Object.keys({ ...target, ...source })\n\n mergedKeys.forEach((key) => {\n if (!Array.isArray(source[key]) && typeof source[key] === 'object') {\n replaced[key] = replace(target[key], source[key])\n }\n else if (target[key] === undefined && source[key] !== undefined) {\n if (typeof target[key] === 'object') {\n replaced[key] = { ...source[key] }\n }\n else {\n replaced[key] = source[key]\n }\n }\n else if (target[key] !== undefined && source[key] === undefined) {\n if (typeof target[key] === 'object') {\n replaced[key] = { ...target[key] }\n }\n else {\n replaced[key] = target[key]\n }\n }\n else if (target[key] !== undefined && source[key] !== undefined) {\n if (typeof source[key] === 'object') {\n replaced[key] = { ...source[key] }\n }\n else {\n replaced[key] = source[key]\n }\n }\n })\n\n return replaced\n }\n\n if (!items) {\n return this\n }\n\n if (!Array.isArray(items) && typeof items !== 'object') {\n return new this.constructor(replace(this.items, [items]))\n }\n\n if (items.constructor.name === 'Collection') {\n return new this.constructor(replace(this.items, items.all()))\n }\n\n return new this.constructor(replace(this.items, items))\n }\n\n reverse() {\n const collection = [].concat(this.items).reverse()\n\n return new this.constructor(collection)\n }\n\n search(valueOrFunction, strict) {\n let result\n\n const find = (item, key) => {\n if (isFunction(valueOrFunction)) {\n return valueOrFunction(this.items[key], key)\n }\n\n if (strict) {\n return this.items[key] === valueOrFunction\n }\n\n return this.items[key] == valueOrFunction\n }\n\n if (isArray(this.items)) {\n result = this.items.findIndex(find)\n }\n else if (isObject(this.items)) {\n result = Object.keys(this.items).find(key => find(this.items[key], key))\n }\n\n if (result === undefined || result < 0) {\n return false\n }\n\n return result\n }\n\n shift(count = 1): T | undefined | null {\n if (this.isEmpty()) {\n return null\n }\n\n if (isArray(this.items)) {\n if (count === 1) {\n return this.items.shift()\n }\n\n return new this.constructor(this.items.splice(0, count))\n }\n\n if (isObject(this.items)) {\n if (count === 1) {\n const key = Object.keys(this.items)[0]\n const value = this.items[key]\n delete this.items[key]\n\n return value\n }\n\n const keys = Object.keys(this.items)\n const poppedKeys = keys.slice(0, count)\n\n const newObject = poppedKeys.reduce((acc, current) => {\n acc[current] = this.items[current]\n\n return acc\n }, {})\n\n deleteKeys(this.items, poppedKeys)\n\n return new this.constructor(newObject)\n }\n\n return null\n }\n\n shuffle(): Collection<T> {\n const items = values(this.items)\n\n let j\n let x\n let i\n\n for (i = items.length; i; i -= 1) {\n j = Math.floor(Math.random() * i)\n x = items[i - 1]\n items[i - 1] = items[j]\n items[j] = x\n }\n\n this.items = items\n\n return this\n }\n\n skip(number: number): Collection<T> {\n if (isObject(this.items)) {\n return new this.constructor(\n Object.keys(this.items).reduce((accumulator, key, index) => {\n if (index + 1 > number) {\n accumulator[key] = this.items[key]\n }\n\n return accumulator\n }, {}),\n )\n }\n\n return new this.constructor(this.items.slice(number))\n }\n\n skipUntil(valueOrFunction: any): Collection<T> {\n let previous = null\n let items\n\n let callback = value => value === valueOrFunction\n if (isFunction(valueOrFunction)) {\n callback = valueOrFunction\n }\n\n if (isArray(this.items)) {\n items = this.items.filter((item) => {\n if (previous !== true) {\n previous = callback(item)\n }\n\n return previous\n })\n }\n\n if (isObject(this.items)) {\n items = Object.keys(this.items).reduce((acc, key) => {\n if (previous !== true) {\n previous = callback(this.items[key])\n }\n\n if (previous !== false) {\n acc[key] = this.items[key]\n }\n\n return acc\n }, {})\n }\n\n return new this.constructor(items)\n }\n\n skipWhile(valueOrFunction: any): Collection<T> {\n let previous = null\n let items\n\n let callback = value => value === valueOrFunction\n if (isFunction(valueOrFunction)) {\n callback = valueOrFunction\n }\n\n if (isArray(this.items)) {\n items = this.items.filter((item) => {\n if (previous !== true) {\n previous = !callback(item)\n }\n\n return previous\n })\n }\n\n if (isObject(this.items)) {\n items = Object.keys(this.items).reduce((acc, key) => {\n if (previous !== true) {\n previous = !callback(this.items[key])\n }\n\n if (previous !== false) {\n acc[key] = this.items[key]\n }\n\n return acc\n }, {})\n }\n\n return new this.constructor(items)\n }\n\n slice(remove: number, limit: number): Collection<T> {\n let collection = this.items.slice(remove)\n\n if (limit !== undefined) {\n collection = collection.slice(0, limit)\n }\n\n return new this.constructor(collection)\n }\n\n sole(): T {\n if (this.items.length !== 1) {\n throw new Error('Collection does not contain exactly one item.')\n }\n return this.items[0]\n }\n\n some(key: string): boolean {\n return this.items.some(item => item.hasOwnProperty(key))\n }\n\n sort(fn: (a: T, b: T) => number): Collection<T> {\n const collection = [].concat(this.items)\n\n if (fn === undefined) {\n if (this.every(item => typeof item === 'number')) {\n collection.sort((a, b) => a - b)\n }\n else {\n collection.sort()\n }\n }\n else {\n collection.sort(fn)\n }\n\n return new this.constructor(collection)\n }\n\n sortDesc(): Collection<T> {\n return this.sort().reverse()\n }\n\n sortBy(valueOrFunction: any): Collection<T> {\n const collection = [].concat(this.items)\n const getValue = (item) => {\n if (isFunction(valueOrFunction)) {\n return valueOrFunction(item)\n }\n\n return nestedValue(item, valueOrFunction)\n }\n\n collection.sort((a, b) => {\n const valueA = getValue(a)\n const valueB = getValue(b)\n\n if (valueA === null || valueA === undefined) {\n return 1\n }\n if (valueB === null || valueB === undefined) {\n return -1\n }\n\n if (valueA < valueB) {\n return -1\n }\n if (valueA > valueB) {\n return 1\n }\n\n return 0\n })\n\n return new this.constructor(collection)\n }\n\n sortByDesc(valueOrFunction: any): Collection<T> {\n return this.sortBy(valueOrFunction).reverse()\n }\n\n sortKeys(): Collection<T> {\n const ordered = {}\n\n Object.keys(this.items)\n .sort()\n .forEach((key) => {\n ordered[key] = this.items[key]\n })\n\n return new this.constructor(ordered)\n }\n\n sortKeysDesc(): Collection<T> {\n const ordered = {}\n\n Object.keys(this.items)\n .sort()\n .reverse()\n .forEach((key) => {\n ordered[key] = this.items[key]\n })\n\n return new this.constructor(ordered)\n }\n\n splice(index: number, limit: number, replace: any): Collection<T> {\n const slicedCollection = this.slice(index, limit)\n\n this.items = this.diff(slicedCollection.all()).all()\n\n if (Array.isArray(replace)) {\n for (let iterator = 0, { length } = replace; iterator < length; iterator += 1) {\n this.items.splice(index + iterator, 0, replace[iterator])\n }\n }\n\n return slicedCollection\n }\n\n split(numberOfGroups: number): Collection<T[]> {\n const itemsArray = this.toArray()\n const groups: T[][] = []\n const size = Math.ceil(itemsArray.length / numberOfGroups)\n\n for (let i = 0; i < itemsArray.length; i += size) {\n groups.push(itemsArray.slice(i, i + size))\n }\n\n return new Collection(groups)\n }\n\n sum(key?: string | ((item: T) => number)): number {\n const items = values(this.items)\n\n let total = 0\n\n if (key === undefined) {\n for (let i = 0, { length } = items; i < length; i += 1) {\n total += Number.parseFloat(items[i])\n }\n }\n else if (isFunction(key)) {\n for (let i = 0, { length } = items; i < length; i += 1) {\n total += Number.parseFloat(key(items[i]))\n }\n }\n else {\n for (let i = 0, { length } = items; i < length; i += 1) {\n total += Number.parseFloat(items[i][key])\n }\n }\n\n return Number.parseFloat(total.toPrecision(12))\n }\n\n take(length: number): Collection<T> {\n if (!Array.isArray(this.items) && typeof this.items === 'object') {\n const keys = Object.keys(this.items)\n let slicedKeys\n\n if (length < 0) {\n slicedKeys = keys.slice(length)\n }\n else {\n slicedKeys = keys.slice(0, length)\n }\n\n const collection = {}\n\n keys.forEach((prop) => {\n if (slicedKeys.includes(prop)) {\n collection[prop] = this.items[prop]\n }\n })\n\n return new this.constructor(collection)\n }\n\n if (length < 0) {\n return new this.constructor(this.items.slice(length))\n }\n\n return new this.constructor(this.items.slice(0, length))\n }\n\n takeUntil(valueOrFunction): Collection<T> {\n let previous = null\n let items\n\n let callback = value => value === valueOrFunction\n if (isFunction(valueOrFunction)) {\n callback = valueOrFunction\n }\n\n if (isArray(this.items)) {\n items = this.items.filter((item) => {\n if (previous !== false) {\n previous = !callback(item)\n }\n\n return previous\n })\n }\n\n if (isObject(this.items)) {\n items = Object.keys(this.items).reduce((acc, key) => {\n if (previous !== false) {\n previous = !callback(this.items[key])\n }\n\n if (previous !== false) {\n acc[key] = this.items[key]\n }\n\n return acc\n }, {})\n }\n\n return new this.constructor(items)\n }\n\n takeWhile(valueOrFunction: any): Collection<T> {\n let previous = null\n let items\n\n let callback = value => value === valueOrFunction\n if (isFunction(valueOrFunction)) {\n callback = valueOrFunction\n }\n\n if (isArray(this.items)) {\n items = this.items.filter((item) => {\n if (previous !== false) {\n previous = callback(item)\n }\n\n return previous\n })\n }\n\n if (isObject(this.items)) {\n items = Object.keys(this.items).reduce((acc, key) => {\n if (previous !== false) {\n previous = callback(this.items[key])\n }\n\n if (previous !== false) {\n acc[key] = this.items[key]\n }\n\n return acc\n }, {})\n }\n\n return new this.constructor(items)\n }\n\n tap(fn: (collection: Collection<T>) => void): Collection<T> {\n fn(this)\n\n return this\n }\n\n times(n: number, fn: (iterator: number) => void): Collection<T> {\n for (let iterator = 1; iterator <= n; iterator += 1) {\n this.items.push(fn(iterator))\n }\n\n return this\n }\n\n toArray(): T[] {\n return Array.isArray(this.items) ? this.items : Object.values(this.items)\n }\n\n toJson(): string {\n return JSON.stringify(this.items)\n }\n\n transform(fn: (item: T, key: string) => T): Collection<T> {\n if (Array.isArray(this.items)) {\n this.items = this.items.map(fn)\n }\n else {\n const collection = {}\n\n Object.keys(this.items).forEach((key) => {\n collection[key] = fn(this.items[key], key)\n })\n\n this.items = collection\n }\n\n return this\n }\n\n undot(): Collection<T> {\n if (Array.isArray(this.items)) {\n return this\n }\n\n let collection = {}\n\n Object.keys(this.items).forEach((key) => {\n if (key.includes('.')) {\n const obj = collection\n\n key.split('.').reduce((acc, current, index, array) => {\n if (!acc[current]) {\n acc[current] = {}\n }\n\n if (index === array.length - 1) {\n acc[current] = this.items[key]\n }\n\n return acc[current]\n }, obj)\n\n collection = { ...collection, ...obj }\n }\n else {\n collection[key] = this.items[key]\n }\n })\n\n return new this.constructor(collection)\n }\n\n unless<T>(value: any, fn: (collection: this) => T, defaultFn?: () => T): T | undefined {\n if (!value) {\n return fn(this)\n }\n\n if (defaultFn)\n return defaultFn()\n return undefined\n }\n\n unlessEmpty(callback: (collection: Collection<T>) => void): this {\n if (!this.isEmpty()) {\n callback(this)\n }\n\n return this\n }\n\n unlessNotEmpty(callback: (collection: Collection<T>) => void): Collection<T> {\n if (this.isEmpty()) {\n callback(this)\n }\n\n return this\n }\n\n union(object: Record<string, T>): Collection<T> {\n const collection = JSON.parse(JSON.stringify(this.items))\n\n Object.keys(object).forEach((prop) => {\n if (this.items[prop] === undefined) {\n collection[prop] = object[prop]\n }\n })\n\n return new this.constructor(collection)\n }\n\n unique(): Collection<T> {\n const uniqueItems = Array.from(new Set(this.items))\n return new this.constructor(uniqueItems)\n }\n\n unwrap(): T[] | Record<string, T> {\n return this.items\n }\n\n values(): Collection<T> {\n return new Collection(Object.values(this.items))\n }\n\n when(\n value: any,\n callback: (collection: Collection<T>, value: any) => void,\n defaultCallback?: () => void,\n ): Collection<T> {\n if (value) {\n callback(this, value)\n }\n else if (defaultCallback) {\n defaultCallback()\n }\n return this\n }\n\n whenEmpty(fn, defaultFn) {\n if (Array.isArray(this.items) && !this.items.length) {\n return fn(this)\n }\n if (!Object.keys(this.items).length) {\n return fn(this)\n }\n\n if (defaultFn !== undefined) {\n if (Array.isArray(this.items) && this.items.length) {\n return defaultFn(this)\n }\n if (Object.keys(this.items).length) {\n return defaultFn(this)\n }\n }\n\n return this\n }\n\n whenNotEmpty(fn: (collection: Collection<T>) => void, defaultFn: (collection: Collection<T>) => void): Collection<T> {\n if (Array.isArray(this.items) && this.items.length) {\n return fn(this)\n }\n\n if (Object.keys(this.items).length) {\n return fn(this)\n }\n\n if (defaultFn !== undefined) {\n if (Array.isArray(this.items) && !this.items.length) {\n return defaultFn(this)\n }\n if (!Object.keys(this.items).length) {\n return defaultFn(this)\n }\n }\n\n return this\n }\n\n where(key: string, operator?: any, value?: any): Collection<T> {\n // If only one argument is passed, we're checking for existence\n if (arguments.length === 1) {\n return new Collection(this.items.filter(item => item[key] !== undefined))\n }\n\n // If two arguments are passed, the second one is the value\n if (arguments.length === 2) {\n value = operator\n operator = '==='\n }\n\n const compareValues = (item: any, key: string, value: any, operator: string) => {\n const itemValue = item[key]\n\n switch (operator) {\n case '===':\n return itemValue === value\n case '!==':\n return itemValue !== value\n case '<':\n return itemValue < value\n case '<=':\n return itemValue <= value\n case '>':\n return itemValue > value\n case '>=':\n return itemValue >= value\n default:\n return itemValue == value\n }\n }\n\n return new Collection(this.items.filter(item => compareValues(item, key, value, operator)))\n }\n\n whereBetween(key: string, values: [number, number]): Collection<T> {\n return this.filter((item) => {\n const itemValue = typeof item === 'object' ? item[key] : item\n return itemValue >= values[0] && itemValue <= values[1]\n })\n }\n\n whereIn(key: string, values: any[]): Collection<T> {\n return this.filter((item) => {\n const itemValue = typeof item === 'object' ? item[key] : item\n return values.includes(itemValue)\n })\n }\n\n whereNotBetween(key: string, values: [number, number]): Collection<T> {\n return this.filter((item) => {\n const itemValue = typeof item === 'object' ? item[key] : item\n return itemValue < values[0] || itemValue > values[1]\n })\n }\n\n whereNotIn(key: string, values: any[]): Collection<T> {\n const filteredItems = this.items.filter((item) => {\n const keys = key.split('.')\n let value = item\n\n for (const k of keys) {\n if (value[k] === undefined)\n return true\n value = value[k]\n }\n\n return !values.includes(value)\n })\n\n return new Collection(filteredItems)\n }\n\n private getNestedValue(item: any, key: string): any {\n const keys = key.split('.')\n return keys.reduce((obj, k) => (obj && obj[k] !== undefined ? obj[k] : null), item)\n }\n\n whereInstanceOf(type: any): Collection<T> {\n return this.filter(item => item instanceof type)\n }\n\n whereNotNull(key: string): Collection<T> {\n return this.where(key, '!==', null)\n }\n\n whereNull(key: string): Collection<T> {\n return this.where(key, '===', null)\n }\n\n static wrap<T>(value: T | T[] | Collection<T>): Collection<T> {\n if (value instanceof Collection)\n return value\n return new Collection(Array.isArray(value) ? value : [value])\n }\n\n static unwrap<T extends object>(value: T | T[] | Collection<T>): T | T[] {\n if (value instanceof Collection) {\n return value.all()\n }\n\n return value\n }\n\n wrap(value: any): Collection<T> {\n if (value instanceof Collection) {\n return value\n }\n\n if (typeof value === 'object') {\n return new Collection(value)\n }\n\n return new Collection([value])\n }\n\n zip(...arrays: any[]): Collection<any> {\n const arrayOfArrays = arrays.map(arg => this.constructor.wrap(arg).all())\n const zipped = this.items.map((item, index) => {\n const values = [item]\n arrayOfArrays.forEach((array) => {\n values.push(array[index])\n })\n return new this.constructor(values) // Wrap each zipped item in a new Collection\n })\n return new this.constructor(zipped)\n }\n}\n\nconst buildKeyPathMap = function buildKeyPathMap(items: any) {\n const keyPaths = {}\n\n items.forEach((item: any, index: number) => {\n function buildKeyPath(val: any, keyPath: string) {\n if (isObject(val)) {\n Object.keys(val).forEach((prop) => {\n buildKeyPath(val[prop], `${keyPath}.${prop}`)\n })\n }\n else if (isArray(val)) {\n val.forEach((v, i) => {\n buildKeyPath(v, `${keyPath}.${i}`)\n })\n }\n\n keyPaths[keyPath] = val\n }\n\n buildKeyPath(item, index)\n })\n\n return keyPaths\n}\n\nfunction SymbolIterator() {\n let index = -1\n\n return {\n next: () => {\n index += 1\n\n return {\n value: this.items[index],\n done: index >= this.items.length,\n }\n },\n }\n}\n\nexport default collect\n"
|
|
13
|
-
],
|
|
14
|
-
"mappings": "AAAA,IAAa,OAAT,EAA6B,eAAT,EAAqC,yBAAT,EAA+C,oBAAT,EAA0C,eAAT,GAAjG,OAAyH,EAAE,OAAO,UAAU,eAAmB,EAAE,CAAC,EAAE,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,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A0E5372FB64756E2164756E21",
|
|
16
|
-
"names": []
|
|
17
|
-
}
|
package/src/helpers/clone.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clone helper
|
|
3
|
-
*
|
|
4
|
-
* Clone an array or object
|
|
5
|
-
*
|
|
6
|
-
* @param items - The array or object to clone
|
|
7
|
-
* @returns A deep clone of the input
|
|
8
|
-
*/
|
|
9
|
-
export function clone<T>(items: T[]): T[]
|
|
10
|
-
export function clone<T extends object>(items: T): T
|
|
11
|
-
export function clone<T>(items: T[] | T): T[] | T {
|
|
12
|
-
if (Array.isArray(items)) {
|
|
13
|
-
return [...items]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return { ...items }
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { variadic } from './variadic'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Delete keys helper
|
|
5
|
-
*
|
|
6
|
-
* Delete one or multiple keys from an object
|
|
7
|
-
*
|
|
8
|
-
* @param obj - The object from which to delete keys
|
|
9
|
-
* @param keys - The keys to delete
|
|
10
|
-
* @returns {void}
|
|
11
|
-
*/
|
|
12
|
-
export function deleteKeys<T extends object>(obj: T, ...keys: (keyof T)[]): void {
|
|
13
|
-
variadic(keys).forEach((key) => {
|
|
14
|
-
delete obj[key]
|
|
15
|
-
})
|
|
16
|
-
}
|
package/src/helpers/index.ts
DELETED
package/src/helpers/is.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the item is an array.
|
|
3
|
-
* @param item - The item to check.
|
|
4
|
-
* @returns A boolean indicating whether the item is an array.
|
|
5
|
-
*/
|
|
6
|
-
export const isArray = (item: unknown): item is Array<unknown> => Array.isArray(item)
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Checks if the item is an object (excluding arrays and null).
|
|
10
|
-
* @param item - The item to check.
|
|
11
|
-
* @returns A boolean indicating whether the item is an object.
|
|
12
|
-
*/
|
|
13
|
-
export function isObject(item: unknown): item is object {
|
|
14
|
-
return typeof item === 'object' && !Array.isArray(item) && item !== null
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Checks if the item is a function.
|
|
19
|
-
* @param item - The item to check.
|
|
20
|
-
* @returns A boolean indicating whether the item is a function.
|
|
21
|
-
*/
|
|
22
|
-
// eslint-disable-next-line ts/no-unsafe-function-type
|
|
23
|
-
export const isFunction = (item: unknown): item is Function => typeof item === 'function'
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get value of a nested property
|
|
3
|
-
*
|
|
4
|
-
* @param mainObject - The object to search for the nested property
|
|
5
|
-
* @param key - The key path to the nested property, using dot notation
|
|
6
|
-
* @returns The value of the nested property, or the mainObject if not found
|
|
7
|
-
*/
|
|
8
|
-
export function nestedValue<T>(mainObject: T, key: string): any {
|
|
9
|
-
try {
|
|
10
|
-
return key.split('.').reduce((obj: any, property: string) => obj[property], mainObject)
|
|
11
|
-
}
|
|
12
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
13
|
-
catch (err) {
|
|
14
|
-
// If we end up here, we're not working with an object, and mainObject is the value itself
|
|
15
|
-
return mainObject
|
|
16
|
-
}
|
|
17
|
-
}
|
package/src/helpers/values.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Values helper
|
|
3
|
-
*
|
|
4
|
-
* Retrieve values from items when it is an array, object or Collection
|
|
5
|
-
*
|
|
6
|
-
* @param items - The input array, object, or Collection
|
|
7
|
-
* @returns An array of values
|
|
8
|
-
*/
|
|
9
|
-
export function values<T>(items: T[] | { [key: string]: T } | { all: () => T[] }): T[] {
|
|
10
|
-
if (Array.isArray(items)) {
|
|
11
|
-
return [...items]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if ('all' in items && typeof items.all === 'function') {
|
|
15
|
-
return items.all()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return Object.values(items)
|
|
19
|
-
}
|
package/src/helpers/variadic.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variadic helper function
|
|
3
|
-
*
|
|
4
|
-
* @param args - The arguments to process
|
|
5
|
-
* @returns An array of the processed arguments
|
|
6
|
-
*/
|
|
7
|
-
export function variadic<T>(args: T[] | T): T[] {
|
|
8
|
-
if (Array.isArray(args)) {
|
|
9
|
-
return args
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return [args]
|
|
13
|
-
}
|