Releases: ugaya40/leseq
Releases · ugaya40/leseq
v1.12.2
const result1 = from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).pipe(
chunkByAccumulation(
0,
(acc, current) => acc + current,
(acc) => acc <= 10
)
).toArray();
// result1: [[1, 2, 3, 4], [5], [6], [7], [8], [9], [10]]
// Example where the first value doesn't satisfy the condition
const result2 = from([11, 1, 2, 3]).pipe(
chunkByAccumulation(
0,
(acc, current) => acc + current,
(acc) => acc <= 10
)
).toArray();
// result2: []
// Example where enumeration stops when a single value doesn't satisfy the condition
const result3 = from([1, 2, 3, 15, 4, 5]).pipe(
chunkByAccumulation(
0,
(acc, current) => acc + current,
(acc) => acc <= 10
)
).toArray();
// result3: [[1, 2, 3]]
v1.11.0
v1.10.0
- filter/filterAsync with User Defined Type Guard.
const result = from([1,'a',2,'b'])
.pipe(
filter<number | string, string>((i): i is string => typeof i === 'string')
)
.toMutableArray();
//result: ['a','b']
//result type is string[]
- improve return value of all async predicate.
Until now, all async predicate must return Promise.
const result = await rangeAsAsync(1,10).pipe(
takeWhileAsync(async i => i < 5)
).toArrayAsync()
//result: [1,2,3,4]
From now on, all async predicate can also return a boolean if asynchronous processing is not required.
const result = await rangeAsAsync(1,10).pipe(
takeWhileAsync(i => i < 5)
).toArrayAsync()
//result: [1,2,3,4]
v1.9.1
- add catchError/catchErrorAsync.
- fix README.
v1.8.1
breaking change:
- move repeat/repeatAsync from generator to operator
- Rename asyncSeq()/sharedSeq()/sharedAsyncSeq() of To to async()/share()/shareAsync() respectively.
- remove toAsync() from Values.(Use async() of To instead)
v1.7.0
v1.6.1
v1.5.1
v1.5.0
v1.4.4
breaking change:
- The return value of
toArray()
/toArrayAsync()
has been changed fromT[]
toreadonly T[]
.
To returnT[]
,toMutableArray()
/toMutableArrayAsync()
must be used.(Thanks! by @hachibeeDI )