iterable-linq-utility 0.0.3 → 0.0.5

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.
@@ -1,2 +1,2 @@
1
- import { Predicate } from "./types";
1
+ import { Predicate } from "@/types";
2
2
  export declare function filter<T>(iterable: Iterable<T>, predicate: Predicate<T>): Iterable<T>;
@@ -0,0 +1,8 @@
1
+ export * from './filter';
2
+ export * from './map';
3
+ export * from './materialize';
4
+ export * from './max';
5
+ export * from './memoize';
6
+ export * from './min';
7
+ export * from './range';
8
+ export * from './some';
@@ -1,2 +1,2 @@
1
- import { Mapper } from "./types";
1
+ import { Mapper } from "@/types";
2
2
  export declare function map<T, R>(iterable: Iterable<T>, mapper: Mapper<T, R>): Iterable<R>;
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ import type { Comparer } from "@/types";
2
+ export declare function min<T>(iterable: Iterable<T>, comparer?: Comparer<T>): T | null | undefined;
@@ -0,0 +1,6 @@
1
+ export declare function range(end: number): Iterable<number>;
2
+ export declare function range(end: number, reverse?: boolean): Iterable<number>;
3
+ export declare function range(start: number, end: number): Iterable<number>;
4
+ export declare function range(start: number, end: number, step: number): Iterable<number>;
5
+ export declare function range(start: number, end: number, reverse: boolean): Iterable<number>;
6
+ export declare function range(start: number, end: number, step: number, reverse: boolean): Iterable<number>;
File without changes
@@ -0,0 +1 @@
1
+ export * from './linkedList';
package/dist/index.d.ts CHANGED
@@ -1,21 +1,3 @@
1
- export interface ILinqIterable<T> {
2
- [Symbol.iterator](): Iterator<T, any, undefined>;
3
- collectToArray(): T[];
4
- filter(predicate: (value: T, index: number) => boolean): ILinqIterable<T>;
5
- map<R>(mapper: (value: T, index: number) => R): ILinqIterable<R>;
6
- materialize(): ILinqIterable<T>;
7
- max<T>(comparer?: (a: T, b: T, index: number) => boolean): T | null | undefined;
8
- memoize(): ILinqIterable<T>;
9
- some(predicate: (value: T, index: number) => boolean): boolean;
10
- }
11
- declare module "./linqIterable" {
12
- interface LinqIterable<T> {
13
- filter(predicate: (value: T, index: number) => boolean): ILinqIterable<T>;
14
- map<R>(mapper: (value: T, index: number) => R): ILinqIterable<R>;
15
- materialize(): ILinqIterable<T>;
16
- max<T>(comparer?: (a: T, b: T, index: number) => boolean): T | null | undefined;
17
- memoize(): ILinqIterable<T>;
18
- some(predicate: (value: T, index: number) => boolean): boolean;
19
- }
20
- }
1
+ import { type ILinqIterable } from "./linqIterable";
21
2
  export declare function from<T>(iterable: Iterable<T>): ILinqIterable<T>;
3
+ export { ILinqIterable };
@@ -1,59 +1,44 @@
1
- var S = Object.defineProperty;
2
- var y = (e, t, r) => t in e ? S(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var o = (e, t, r) => (y(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- class u {
5
- constructor(t) {
6
- o(this, "iterable");
7
- this.iterable = t;
8
- }
9
- [Symbol.iterator]() {
10
- return this.iterable[Symbol.iterator]();
11
- }
12
- source() {
13
- return this.iterable;
14
- }
15
- collectToArray() {
16
- return [...this.source()];
17
- }
1
+ var I = Object.defineProperty;
2
+ var p = (e, t, r) => t in e ? I(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var i = (e, t, r) => (p(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ function z(e, t) {
5
+ return (r, s) => t(e(r, s), s);
18
6
  }
19
- function b(e, t) {
20
- return (r, i) => t(e(r, i), i);
7
+ function x(e, t) {
8
+ return (r, s) => e(r, s) && t(r, s);
21
9
  }
22
- function w(e, t) {
23
- return (r, i) => e(r, i) && t(r, i);
24
- }
25
- function f(e, t) {
10
+ function m(e, t) {
26
11
  return {
27
12
  done: e,
28
13
  value: t
29
14
  };
30
15
  }
31
- function p() {
16
+ function f() {
32
17
  return { done: !0, value: void 0 };
33
18
  }
34
- function L(e, t) {
35
- return new l(e, t);
19
+ function w(e, t) {
20
+ return new c(e, t);
36
21
  }
37
- class l {
22
+ class c {
38
23
  constructor(t, r) {
39
- o(this, "predicate");
40
- o(this, "source");
41
- let i = r, n = t;
42
- if (n instanceof l) {
43
- const s = n.predicate;
44
- n = n.source, i = w(s, i);
24
+ i(this, "predicate");
25
+ i(this, "source");
26
+ let s = r, n = t;
27
+ if (n instanceof c) {
28
+ const u = n.predicate;
29
+ n = n.source, s = x(u, s);
45
30
  }
46
- this.source = n, this.predicate = i;
31
+ this.source = n, this.predicate = s;
47
32
  }
48
33
  [Symbol.iterator]() {
49
- return new M(this.source, this.predicate);
34
+ return new S(this.source, this.predicate);
50
35
  }
51
36
  }
52
- class M {
37
+ class S {
53
38
  constructor(t, r) {
54
- o(this, "index", 0);
55
- o(this, "sourceIterator");
56
- o(this, "predicate");
39
+ i(this, "index", 0);
40
+ i(this, "sourceIterator");
41
+ i(this, "predicate");
57
42
  this.sourceIterator = t[Symbol.iterator](), this.predicate = r;
58
43
  }
59
44
  next() {
@@ -64,60 +49,60 @@ class M {
64
49
  }
65
50
  }
66
51
  }
67
- function k(e, t) {
68
- return new h(e, t);
52
+ function b(e, t) {
53
+ return new l(e, t);
69
54
  }
70
- class h {
55
+ class l {
71
56
  constructor(t, r) {
72
- o(this, "mapper");
73
- o(this, "source");
74
- let i = r, n = t;
75
- if (n instanceof h) {
76
- const s = n.mapper;
77
- n = n.source, i = b(s, i);
57
+ i(this, "mapper");
58
+ i(this, "source");
59
+ let s = r, n = t;
60
+ if (n instanceof l) {
61
+ const u = n.mapper;
62
+ n = n.source, s = z(u, s);
78
63
  }
79
- this.source = t, this.mapper = i;
64
+ this.source = t, this.mapper = s;
80
65
  }
81
66
  [Symbol.iterator]() {
82
- return new v(this.source, this.mapper);
67
+ return new M(this.source, this.mapper);
83
68
  }
84
69
  }
85
- class v {
70
+ class M {
86
71
  constructor(t, r) {
87
- o(this, "index", 0);
88
- o(this, "sourceIterator");
89
- o(this, "mapper");
72
+ i(this, "index", 0);
73
+ i(this, "sourceIterator");
74
+ i(this, "mapper");
90
75
  this.sourceIterator = t[Symbol.iterator](), this.mapper = r;
91
76
  }
92
77
  next() {
93
78
  const t = this.sourceIterator.next();
94
- return t.done !== !0 ? f(!1, this.mapper(t.value, this.index++)) : p();
79
+ return t.done !== !0 ? m(!1, this.mapper(t.value, this.index++)) : f();
95
80
  }
96
81
  }
97
- function N(e) {
82
+ function y(e) {
98
83
  const t = e[Symbol.iterator](), r = new a();
99
- for (let i = t.next(); i.done !== !0; i = t.next())
100
- r.addLast(i.value);
84
+ for (let s = t.next(); s.done !== !0; s = t.next())
85
+ r.addLast(s.value);
101
86
  return r;
102
87
  }
103
- class A {
88
+ class k {
104
89
  constructor(t = null) {
105
- o(this, "current", null);
90
+ i(this, "current", null);
106
91
  this.current = t;
107
92
  }
108
93
  next() {
109
94
  const t = this.current;
110
- return t === null ? p() : (this.current = t.nextNode, f(!1, t.data));
95
+ return t === null ? f() : (this.current = t.nextNode, m(!1, t.data));
111
96
  }
112
97
  }
113
98
  class a {
114
99
  constructor() {
115
- o(this, "internalSize", 0);
116
- o(this, "head", null);
117
- o(this, "tail", null);
100
+ i(this, "internalSize", 0);
101
+ i(this, "head", null);
102
+ i(this, "tail", null);
118
103
  }
119
104
  [Symbol.iterator]() {
120
- return new A(this.head);
105
+ return new k(this.head);
121
106
  }
122
107
  addFirst(t) {
123
108
  const r = {
@@ -151,65 +136,54 @@ class a {
151
136
  return this.internalSize;
152
137
  }
153
138
  }
154
- function F(e) {
155
- return e instanceof d ? e : new d(e);
139
+ function L(e) {
140
+ return e instanceof h ? e : new h(e);
156
141
  }
157
- class d {
142
+ class h {
158
143
  constructor(t) {
159
- o(this, "source");
144
+ i(this, "source");
160
145
  if (t instanceof a) {
161
146
  this.source = t;
162
147
  return;
163
148
  }
164
- this.source = N(t);
149
+ this.source = y(t);
165
150
  }
166
151
  [Symbol.iterator]() {
167
- return new g(this.source);
152
+ return new N(this.source);
168
153
  }
169
154
  }
170
- class g {
155
+ class N {
171
156
  constructor(t) {
172
- o(this, "sourceIterator");
157
+ i(this, "sourceIterator");
173
158
  this.sourceIterator = t[Symbol.iterator]();
174
159
  }
175
160
  next() {
176
161
  return this.sourceIterator.next();
177
162
  }
178
163
  }
179
- function P(e) {
180
- return typeof e == "function";
181
- }
182
- function R(e, t) {
183
- const r = e[Symbol.iterator]();
184
- let i = 0, n = r.next(), s = n.value;
185
- const I = P(t) ? t : (x, z) => x > z;
186
- for (n = r.next(); n.done !== !0; n = r.next())
187
- s = I(s, n.value, i++) ? s : n.value;
188
- return s == null ? null : s;
189
- }
190
- function q(e) {
191
- return e instanceof m ? e : new m(e);
164
+ function v(e) {
165
+ return e instanceof d ? e : new d(e);
192
166
  }
193
- class m {
167
+ class d {
194
168
  constructor(t) {
195
- o(this, "isMemoized", !1);
196
- o(this, "sourceIterator");
197
- o(this, "linkedList", new a());
198
- o(this, "source");
169
+ i(this, "isMemoized", !1);
170
+ i(this, "sourceIterator");
171
+ i(this, "linkedList", new a());
172
+ i(this, "source");
199
173
  this.source = t, this.sourceIterator = t[Symbol.iterator](), t instanceof a && (this.linkedList = t, this.isMemoized = !0);
200
174
  }
201
175
  [Symbol.iterator]() {
202
- return this.isMemoized ? new T(this.linkedList) : new D(this.sourceIterator, this.linkedList, (t) => this.isMemoized = t.done === !0);
176
+ return this.isMemoized ? new g(this.linkedList) : new A(this.sourceIterator, this.linkedList, (t) => this.isMemoized = t.done === !0);
203
177
  }
204
178
  }
205
- class D {
206
- constructor(t, r, i) {
207
- o(this, "index", 0);
208
- o(this, "linkedList");
209
- o(this, "linkedListIterator");
210
- o(this, "setAsMemoized");
211
- o(this, "sourceIterator");
212
- this.linkedList = r, this.linkedListIterator = r[Symbol.iterator](), this.setAsMemoized = i, this.sourceIterator = t;
179
+ class A {
180
+ constructor(t, r, s) {
181
+ i(this, "index", 0);
182
+ i(this, "linkedList");
183
+ i(this, "linkedListIterator");
184
+ i(this, "setAsMemoized");
185
+ i(this, "sourceIterator");
186
+ this.linkedList = r, this.linkedListIterator = r[Symbol.iterator](), this.setAsMemoized = s, this.sourceIterator = t;
213
187
  }
214
188
  next() {
215
189
  if (this.linkedList.size() > this.index++)
@@ -218,44 +192,53 @@ class D {
218
192
  return this.setAsMemoized(t) || this.linkedList.addLast(t.value), t;
219
193
  }
220
194
  }
221
- class T {
195
+ class g {
222
196
  constructor(t) {
223
- o(this, "memoizedSourceIterator");
197
+ i(this, "memoizedSourceIterator");
224
198
  this.memoizedSourceIterator = t[Symbol.iterator]();
225
199
  }
226
200
  next() {
227
201
  return this.memoizedSourceIterator.next();
228
202
  }
229
203
  }
230
- function $(e, t) {
204
+ function F(e, t) {
231
205
  const r = e[Symbol.iterator]();
232
- let i = 0;
206
+ let s = 0;
233
207
  for (let n = r.next(); n.done !== !0; n = r.next())
234
- if (t(n.value, i++))
208
+ if (t(n.value, s++))
235
209
  return !0;
236
210
  return !1;
237
211
  }
238
- function c(e) {
239
- return new u(e);
212
+ class o {
213
+ constructor(t) {
214
+ i(this, "iterable");
215
+ this.iterable = t;
216
+ }
217
+ [Symbol.iterator]() {
218
+ return this.iterable[Symbol.iterator]();
219
+ }
220
+ collectToArray() {
221
+ return [...this.iterable];
222
+ }
223
+ filter(t) {
224
+ return new o(w(this.iterable, t));
225
+ }
226
+ map(t) {
227
+ return new o(b(this.iterable, t));
228
+ }
229
+ materialize() {
230
+ return new o(L(this.iterable));
231
+ }
232
+ memoize() {
233
+ return new o(v(this.iterable));
234
+ }
235
+ some(t) {
236
+ return F(this.iterable, t);
237
+ }
238
+ }
239
+ function R(e) {
240
+ return new o(e);
240
241
  }
241
- u.prototype.filter = function(e) {
242
- return c(L(this.source(), e));
243
- };
244
- u.prototype.map = function(e) {
245
- return c(k(this.source(), e));
246
- };
247
- u.prototype.materialize = function() {
248
- return c(F(this.source()));
249
- };
250
- u.prototype.max = function(e) {
251
- return R(this.source(), e);
252
- };
253
- u.prototype.memoize = function() {
254
- return c(q(this.source()));
255
- };
256
- u.prototype.some = function(e) {
257
- return $(this.source(), e);
258
- };
259
242
  export {
260
- c as from
243
+ R as from
261
244
  };
@@ -1 +1 @@
1
- (function(u,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(u=typeof globalThis<"u"?globalThis:u||self,s(u["interable-linq-utility"]={}))})(this,function(u){"use strict";var D=Object.defineProperty;var O=(u,s,c)=>s in u?D(u,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):u[s]=c;var i=(u,s,c)=>(O(u,typeof s!="symbol"?s+"":s,c),c);class s{constructor(t){i(this,"iterable");this.iterable=t}[Symbol.iterator](){return this.iterable[Symbol.iterator]()}source(){return this.iterable}collectToArray(){return[...this.source()]}}function c(e,t){return(r,n)=>t(e(r,n),n)}function y(e,t){return(r,n)=>e(r,n)&&t(r,n)}function m(e,t){return{done:e,value:t}}function p(){return{done:!0,value:void 0}}function $(e){return e}function z(e,t){return new h(e,t)}class h{constructor(t,r){i(this,"predicate");i(this,"source");let n=r,o=t;if(o instanceof h){const a=o.predicate;o=o.source,n=y(a,n)}this.source=o,this.predicate=n}[Symbol.iterator](){return new S(this.source,this.predicate)}}class S{constructor(t,r){i(this,"index",0);i(this,"sourceIterator");i(this,"predicate");this.sourceIterator=t[Symbol.iterator](),this.predicate=r}next(){for(;;){const t=this.sourceIterator.next();if(t.done===!0||this.predicate(t.value,this.index++))return t}}}function b(e,t){return new f(e,t)}class f{constructor(t,r){i(this,"mapper");i(this,"source");let n=r,o=t;if(o instanceof f){const a=o.mapper;o=o.source,n=c(a,n)}this.source=t,this.mapper=n}[Symbol.iterator](){return new w(this.source,this.mapper)}}class w{constructor(t,r){i(this,"index",0);i(this,"sourceIterator");i(this,"mapper");this.sourceIterator=t[Symbol.iterator](),this.mapper=r}next(){const t=this.sourceIterator.next();return t.done!==!0?m(!1,this.mapper(t.value,this.index++)):p()}}function L(e){const t=e[Symbol.iterator](),r=new d;for(let n=t.next();n.done!==!0;n=t.next())r.addLast(n.value);return r}class M{constructor(t=null){i(this,"current",null);this.current=t}next(){const t=this.current;return t===null?p():(this.current=t.nextNode,m(!1,t.data))}}class d{constructor(){i(this,"internalSize",0);i(this,"head",null);i(this,"tail",null)}[Symbol.iterator](){return new M(this.head)}addFirst(t){const r={data:t,nextNode:null};switch(this.internalSize){case 0:this.head=r,this.tail=r;break;default:r.nextNode=this.head,this.head=r}return this.internalSize++,this}addLast(t){const r={data:t,nextNode:null};switch(this.internalSize){case 0:this.head=r,this.tail=r;break;default:this.tail.nextNode=r,this.tail=r}return this.internalSize++,this}size(){return this.internalSize}}function k(e){return e instanceof I?e:new I(e)}class I{constructor(t){i(this,"source");if(t instanceof d){this.source=t;return}this.source=L(t)}[Symbol.iterator](){return new v(this.source)}}class v{constructor(t){i(this,"sourceIterator");this.sourceIterator=t[Symbol.iterator]()}next(){return this.sourceIterator.next()}}function N(e){return typeof e=="function"}function g(e,t){const r=e[Symbol.iterator]();let n=0,o=r.next(),a=o.value;const R=N(t)?t:(j,q)=>j>q;for(o=r.next();o.done!==!0;o=r.next())a=R(a,o.value,n++)?a:o.value;return a==null?null:a}function A(e){return e instanceof x?e:new x(e)}class x{constructor(t){i(this,"isMemoized",!1);i(this,"sourceIterator");i(this,"linkedList",new d);i(this,"source");this.source=t,this.sourceIterator=t[Symbol.iterator](),t instanceof d&&(this.linkedList=t,this.isMemoized=!0)}[Symbol.iterator](){return this.isMemoized?new P(this.linkedList):new F(this.sourceIterator,this.linkedList,t=>this.isMemoized=t.done===!0)}}class F{constructor(t,r,n){i(this,"index",0);i(this,"linkedList");i(this,"linkedListIterator");i(this,"setAsMemoized");i(this,"sourceIterator");this.linkedList=r,this.linkedListIterator=r[Symbol.iterator](),this.setAsMemoized=n,this.sourceIterator=t}next(){if(this.linkedList.size()>this.index++)return this.linkedListIterator.next();const t=this.sourceIterator.next();return this.setAsMemoized(t)||this.linkedList.addLast(t.value),t}}class P{constructor(t){i(this,"memoizedSourceIterator");this.memoizedSourceIterator=t[Symbol.iterator]()}next(){return this.memoizedSourceIterator.next()}}function T(e,t){const r=e[Symbol.iterator]();let n=0;for(let o=r.next();o.done!==!0;o=r.next())if(t(o.value,n++))return!0;return!1}function l(e){return new s(e)}s.prototype.filter=function(e){return l(z(this.source(),e))},s.prototype.map=function(e){return l(b(this.source(),e))},s.prototype.materialize=function(){return l(k(this.source()))},s.prototype.max=function(e){return g(this.source(),e)},s.prototype.memoize=function(){return l(A(this.source()))},s.prototype.some=function(e){return T(this.source(),e)},u.from=l,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(a,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(a=typeof globalThis<"u"?globalThis:a||self,o(a["interable-linq-utility"]={}))})(this,function(a){"use strict";var T=Object.defineProperty;var F=(a,o,u)=>o in a?T(a,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[o]=u;var i=(a,o,u)=>(F(a,typeof o!="symbol"?o+"":o,u),u);function o(e,t){return(r,n)=>t(e(r,n),n)}function u(e,t){return(r,n)=>e(r,n)&&t(r,n)}function f(e,t){return{done:e,value:t}}function p(){return{done:!0,value:void 0}}function R(e){return e}function x(e,t){return new d(e,t)}class d{constructor(t,r){i(this,"predicate");i(this,"source");let n=r,s=t;if(s instanceof d){const m=s.predicate;s=s.source,n=u(m,n)}this.source=s,this.predicate=n}[Symbol.iterator](){return new S(this.source,this.predicate)}}class S{constructor(t,r){i(this,"index",0);i(this,"sourceIterator");i(this,"predicate");this.sourceIterator=t[Symbol.iterator](),this.predicate=r}next(){for(;;){const t=this.sourceIterator.next();if(t.done===!0||this.predicate(t.value,this.index++))return t}}}function b(e,t){return new h(e,t)}class h{constructor(t,r){i(this,"mapper");i(this,"source");let n=r,s=t;if(s instanceof h){const m=s.mapper;s=s.source,n=o(m,n)}this.source=t,this.mapper=n}[Symbol.iterator](){return new w(this.source,this.mapper)}}class w{constructor(t,r){i(this,"index",0);i(this,"sourceIterator");i(this,"mapper");this.sourceIterator=t[Symbol.iterator](),this.mapper=r}next(){const t=this.sourceIterator.next();return t.done!==!0?f(!1,this.mapper(t.value,this.index++)):p()}}function y(e){const t=e[Symbol.iterator](),r=new l;for(let n=t.next();n.done!==!0;n=t.next())r.addLast(n.value);return r}class M{constructor(t=null){i(this,"current",null);this.current=t}next(){const t=this.current;return t===null?p():(this.current=t.nextNode,f(!1,t.data))}}class l{constructor(){i(this,"internalSize",0);i(this,"head",null);i(this,"tail",null)}[Symbol.iterator](){return new M(this.head)}addFirst(t){const r={data:t,nextNode:null};switch(this.internalSize){case 0:this.head=r,this.tail=r;break;default:r.nextNode=this.head,this.head=r}return this.internalSize++,this}addLast(t){const r={data:t,nextNode:null};switch(this.internalSize){case 0:this.head=r,this.tail=r;break;default:this.tail.nextNode=r,this.tail=r}return this.internalSize++,this}size(){return this.internalSize}}function k(e){return e instanceof I?e:new I(e)}class I{constructor(t){i(this,"source");if(t instanceof l){this.source=t;return}this.source=y(t)}[Symbol.iterator](){return new L(this.source)}}class L{constructor(t){i(this,"sourceIterator");this.sourceIterator=t[Symbol.iterator]()}next(){return this.sourceIterator.next()}}function v(e){return e instanceof z?e:new z(e)}class z{constructor(t){i(this,"isMemoized",!1);i(this,"sourceIterator");i(this,"linkedList",new l);i(this,"source");this.source=t,this.sourceIterator=t[Symbol.iterator](),t instanceof l&&(this.linkedList=t,this.isMemoized=!0)}[Symbol.iterator](){return this.isMemoized?new g(this.linkedList):new N(this.sourceIterator,this.linkedList,t=>this.isMemoized=t.done===!0)}}class N{constructor(t,r,n){i(this,"index",0);i(this,"linkedList");i(this,"linkedListIterator");i(this,"setAsMemoized");i(this,"sourceIterator");this.linkedList=r,this.linkedListIterator=r[Symbol.iterator](),this.setAsMemoized=n,this.sourceIterator=t}next(){if(this.linkedList.size()>this.index++)return this.linkedListIterator.next();const t=this.sourceIterator.next();return this.setAsMemoized(t)||this.linkedList.addLast(t.value),t}}class g{constructor(t){i(this,"memoizedSourceIterator");this.memoizedSourceIterator=t[Symbol.iterator]()}next(){return this.memoizedSourceIterator.next()}}function A(e,t){const r=e[Symbol.iterator]();let n=0;for(let s=r.next();s.done!==!0;s=r.next())if(t(s.value,n++))return!0;return!1}class c{constructor(t){i(this,"iterable");this.iterable=t}[Symbol.iterator](){return this.iterable[Symbol.iterator]()}collectToArray(){return[...this.iterable]}filter(t){return new c(x(this.iterable,t))}map(t){return new c(b(this.iterable,t))}materialize(){return new c(k(this.iterable))}memoize(){return new c(v(this.iterable))}some(t){return A(this.iterable,t)}}function P(e){return new c(e)}a.from=P,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,7 +1,21 @@
1
- export declare class LinqIterable<T> implements Iterable<T> {
1
+ import { Mapper, Predicate } from '@/types';
2
+ export interface ILinqIterable<T> {
3
+ [Symbol.iterator](): Iterator<T, any, undefined>;
4
+ collectToArray(): T[];
5
+ filter(predicate: Predicate<T>): ILinqIterable<T>;
6
+ map<R>(mapper: Mapper<T, R>): ILinqIterable<R>;
7
+ materialize(): ILinqIterable<T>;
8
+ memoize(): ILinqIterable<T>;
9
+ some(predicate: (value: T, index: number) => boolean): boolean;
10
+ }
11
+ export declare class LinqIterable<T> implements ILinqIterable<T> {
2
12
  constructor(iterable: Iterable<T>);
3
13
  [Symbol.iterator](): Iterator<T, any, undefined>;
4
14
  private iterable;
5
- source(): Iterable<T>;
6
15
  collectToArray(): T[];
16
+ filter(predicate: Predicate<T>): ILinqIterable<T>;
17
+ map<R>(mapper: Mapper<T, R>): ILinqIterable<R>;
18
+ materialize(): ILinqIterable<T>;
19
+ memoize(): ILinqIterable<T>;
20
+ some(predicate: (value: T, index: number) => boolean): boolean;
7
21
  }
@@ -1 +1,2 @@
1
+ export * from './iteratorResults';
1
2
  export * from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iterable-linq-utility",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "An Iterable mutation utility inspired by .net Linq and Javascript Array interface",
5
5
  "type": "module",
6
6
  "main": "./dist/my-lib.umd.cjs",
@@ -16,7 +16,7 @@
16
16
  "dist"
17
17
  ],
18
18
  "scripts": {
19
- "build": "tsc && vite build",
19
+ "build": "tsc -p tsconfig.build.json && vite build",
20
20
  "dev": "vite",
21
21
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-path .eslintignore",
22
22
  "lint-fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix --ignore-path .eslintignore",
@@ -49,6 +49,7 @@
49
49
  "typescript": "4.9.3",
50
50
  "vite": "3.2.4",
51
51
  "vite-plugin-dts": "1.7.1",
52
+ "vite-tsconfig-paths": "3.6.0",
52
53
  "vitest": "0.25.3"
53
54
  }
54
55
  }