diff --git a/CHANGELOG.md b/CHANGELOG.md index ef62c587..47f12cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +10.3.4 + +- Fix wrong typing for `R.sortByDescending` - [Issue #797](https://github.com/selfrefactor/rambda/issues/797) + +- Improve `R.mapParallelAsync` typings to allow optional `batchSize` parameter. + +- Change order of inputs in `R.mapPropObject` + +- Change REPL links in documentation + +- Remove `jsr.json` + 10.3.3 - Fix wrong typing for `R.reject` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779) diff --git a/README.md b/README.md index eebbe342..927e5c96 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ const result = pipe( //=> [6, 8] ``` -You can test this example in Rambda's REPL +You can test this example in Rambda's REPL * [API](#api) * [Changelog](#-changelog) @@ -183,7 +183,7 @@ const result = R.pipe( // => { a: 1, b: 'foo', c: 3 } ``` -Try this R.addProp example in Rambda REPL +Try this R.addProp example in Rambda REPL
@@ -278,7 +278,7 @@ const result = R.pipe( // => [{a: 1, b: 2, c: '3'}, {a: 3, b: 4, c: '7'}] ``` -Try this R.addPropToObjects example in Rambda REPL +Try this R.addPropToObjects example in Rambda REPL
@@ -393,7 +393,7 @@ const result = R.pipe( ) // => true ``` -Try this R.all example in Rambda REPL +Try this R.all example in Rambda REPL
@@ -491,7 +491,7 @@ const result = R.pipe( ) // => [[1, 2, 3, 4]] ``` -Try this R.allPass example in Rambda REPL +Try this R.allPass example in Rambda REPL
@@ -591,7 +591,7 @@ R.any(predicate)(list) // => true ``` -Try this R.any example in Rambda REPL +Try this R.any example in Rambda REPL
@@ -688,7 +688,7 @@ const result = fn(input) // => true ``` -Try this R.anyPass example in Rambda REPL +Try this R.anyPass example in Rambda REPL
@@ -838,7 +838,7 @@ const result = R.append('foo')(['bar', 'baz']) // => ['bar', 'baz', 'foo'] ``` -Try this R.append example in Rambda REPL +Try this R.append example in Rambda REPL
@@ -930,7 +930,7 @@ const result = R.pipe( // => [{a: 0}, {a: 1}, {a: 2}] ``` -Try this R.ascend example in Rambda REPL +Try this R.ascend example in Rambda REPL
@@ -1136,7 +1136,7 @@ const result = condition(input) // => true ``` -Try this R.checkObjectWithSpec example in Rambda REPL +Try this R.checkObjectWithSpec example in Rambda REPL
@@ -1272,7 +1272,7 @@ const result = R.pipe( // => { a: ['a', 'b', 'c'], b: [1, 2, 3], c: { a: 1, b: 2, c: 0, f: false } } ``` -Try this R.compact example in Rambda REPL +Try this R.compact example in Rambda REPL
@@ -1392,7 +1392,7 @@ const result = [ ] => [ true, false ] ``` -Try this R.complement example in Rambda REPL +Try this R.complement example in Rambda REPL
@@ -1473,7 +1473,7 @@ R.concat([1, 2])([3, 4]) // => [1, 2, 3, 4] R.concat('foo')('bar') // => 'foobar' ``` -Try this R.concat example in Rambda REPL +Try this R.concat example in Rambda REPL
@@ -1592,7 +1592,7 @@ const result = R.count(x => x.a !== undefined)(list) // => 2 ``` -Try this R.count example in Rambda REPL +Try this R.count example in Rambda REPL
@@ -1683,7 +1683,7 @@ const expected = { a: 2, b: 2, c: 2 } // => `result` is equal to `expected` ``` -Try this R.countBy example in Rambda REPL +Try this R.countBy example in Rambda REPL
@@ -1781,7 +1781,7 @@ const result = R.createObjectFromKeys( // => {a: 'a-0', b: 'b-1', c: 'c-2'} ``` -Try this R.createObjectFromKeys example in Rambda REPL +Try this R.createObjectFromKeys example in Rambda REPL
@@ -1857,7 +1857,7 @@ R.defaultTo('foo'))(undefined) // => 'foo' R.defaultTo('foo')('') // => 'foo' ``` -Try this R.defaultTo example in Rambda REPL +Try this R.defaultTo example in Rambda REPL
@@ -1956,7 +1956,7 @@ const result = R.pipe( // => [{a: 2}, {a: 1}, {a: 0}] ``` -Try this R.descend example in Rambda REPL +Try this R.descend example in Rambda REPL
@@ -2002,7 +2002,7 @@ It returns `howMany` items dropped from beginning of list. R.drop(2)(['foo', 'bar', 'baz']) // => ['baz'] ``` -Try this R.drop example in Rambda REPL +Try this R.drop example in Rambda REPL
@@ -2135,7 +2135,7 @@ const result = dropLastWhile(predicate)(list); // => [1, 2] ``` -Try this R.dropLastWhile example in Rambda REPL +Try this R.dropLastWhile example in Rambda REPL
@@ -2219,7 +2219,7 @@ const result = R.dropRepeatsBy( // => [1, 2, 3] ``` -Try this R.dropRepeatsBy example in Rambda REPL +Try this R.dropRepeatsBy example in Rambda REPL
@@ -2247,7 +2247,7 @@ const result = R.dropRepeatsWith(R.prop('a'))(list) // => [{a:1,b:2}, {a:2, b:4}] ``` -Try this R.dropRepeatsWith example in Rambda REPL +Try this R.dropRepeatsWith example in Rambda REPL
@@ -2275,7 +2275,7 @@ const result = R.dropWhile(predicate)(list) // => [3, 4] ``` -Try this R.dropWhile example in Rambda REPL +Try this R.dropWhile example in Rambda REPL
@@ -2394,7 +2394,7 @@ const result = R.duplicateBy(x => x, list) // => [{a:1}] ``` -Try this R.duplicateBy example in Rambda REPL +Try this R.duplicateBy example in Rambda REPL
@@ -2462,7 +2462,7 @@ const result = R.eqBy(Math.abs, 5)(-5) // => true ``` -Try this R.eqBy example in Rambda REPL +Try this R.eqBy example in Rambda REPL
@@ -2531,7 +2531,7 @@ const result = R.eqProps('a', obj1)(obj2) // => true ``` -Try this R.eqProps example in Rambda REPL +Try this R.eqProps example in Rambda REPL
@@ -2630,7 +2630,7 @@ R.equals( ) // => true ``` -Try this R.equals example in Rambda REPL +Try this R.equals example in Rambda REPL
@@ -3122,7 +3122,7 @@ const result = R.pipe( // => result is { foo: 3, baz: 'baz' } ``` -Try this R.evolve example in Rambda REPL +Try this R.evolve example in Rambda REPL
@@ -3228,7 +3228,7 @@ const result = [ // => [true, true ] ``` -Try this R.excludes example in Rambda REPL +Try this R.excludes example in Rambda REPL
@@ -3321,7 +3321,7 @@ const result = R.filter(predicate)(list) // => [2, 3] ``` -Try this R.filter example in Rambda REPL +Try this R.filter example in Rambda REPL
@@ -3583,7 +3583,7 @@ const result = R.filterObject( // => {a: 1, c: 3} ``` -Try this R.filterObject example in Rambda REPL +Try this R.filterObject example in Rambda REPL
@@ -3691,7 +3691,7 @@ const result = R.find(predicate)(list) // => {foo: 1} ``` -Try this R.find example in Rambda REPL +Try this R.find example in Rambda REPL
@@ -3795,7 +3795,7 @@ const result = R.findIndex(predicate)(list) // => 1 ``` -Try this R.findIndex example in Rambda REPL +Try this R.findIndex example in Rambda REPL
@@ -3890,7 +3890,7 @@ const result = R.findLast(predicate)(list) // => {foo: 1} ``` -Try this R.findLast example in Rambda REPL +Try this R.findLast example in Rambda REPL
@@ -3945,7 +3945,7 @@ const result = R.findLastIndex(predicate)(list) // => 1 ``` -Try this R.findLastIndex example in Rambda REPL +Try this R.findLastIndex example in Rambda REPL
@@ -4034,7 +4034,7 @@ const result = R.findNth(predicate, 2)(list) // => {foo: 2} ``` -Try this R.findNth example in Rambda REPL +Try this R.findNth example in Rambda REPL
@@ -4112,7 +4112,7 @@ const result = R.flatMap(duplicate)(list) // => [ 1, 1, 2, 2, 3, 3 ] ``` -Try this R.flatMap example in Rambda REPL +Try this R.flatMap example in Rambda REPL
@@ -4233,7 +4233,7 @@ const result = R.flatten([ // => [ 1, 2, 3, 30, 300, 4 ] ``` -Try this R.flatten example in Rambda REPL +Try this R.flatten example in Rambda REPL
@@ -4331,7 +4331,7 @@ const result = R.flattenObject( // => [3, 1, 2] or [2, 3, 1] or ... ``` -Try this R.flattenObject example in Rambda REPL +Try this R.flattenObject example in Rambda REPL
@@ -4555,7 +4555,7 @@ const result = R.groupBy(groupFn, list) // => { '1': ['a', 'b'], '2': ['aa', 'bb'] } ``` -Try this R.groupBy example in Rambda REPL +Try this R.groupBy example in Rambda REPL
@@ -4672,7 +4672,7 @@ const result = [ // => [1, 'f'] ``` -Try this R.head example in Rambda REPL +Try this R.head example in Rambda REPL
@@ -4795,7 +4795,7 @@ const result = [ // => [true, true ] ``` -Try this R.includes example in Rambda REPL +Try this R.includes example in Rambda REPL
@@ -4927,7 +4927,7 @@ const result = R.indexBy( // => {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} ``` -Try this R.indexBy example in Rambda REPL +Try this R.indexBy example in Rambda REPL
@@ -5029,7 +5029,7 @@ const result = [ // => [0, 1] ``` -Try this R.indexOf example in Rambda REPL +Try this R.indexOf example in Rambda REPL
@@ -5129,7 +5129,7 @@ const result = [ // => [[1, 2], 'fo'] ``` -Try this R.init example in Rambda REPL +Try this R.init example in Rambda REPL
@@ -5235,7 +5235,7 @@ const result = R.innerJoin(predicate, list1)(list2) // => [4, 5] ``` -Try this R.innerJoin example in Rambda REPL +Try this R.innerJoin example in Rambda REPL
@@ -5357,7 +5357,7 @@ const expected = 'foo is BAR even 1 more' // => `result` is equal to `expected` ``` -Try this R.interpolate example in Rambda REPL +Try this R.interpolate example in Rambda REPL
@@ -5466,7 +5466,7 @@ const result = R.intersection(listA)(listB) // => [{ id : 3 }, { id : 4 }] ``` -Try this R.intersection example in Rambda REPL +Try this R.intersection example in Rambda REPL
@@ -5561,7 +5561,7 @@ const result = R.intersperse(separator)(list) // => [0, 10, 1, 10, 2, 10, 3] ``` -Try this R.intersperse example in Rambda REPL +Try this R.intersperse example in Rambda REPL
@@ -5656,7 +5656,7 @@ It returns a string of all `list` instances joined with a `glue`. R.join('-', [1, 2, 3]) // => '1-2-3' ``` -Try this R.join example in Rambda REPL +Try this R.join example in Rambda REPL
@@ -5721,7 +5721,7 @@ const result = [ // => [3, 'o'] ``` -Try this R.last example in Rambda REPL +Try this R.last example in Rambda REPL
@@ -5800,7 +5800,7 @@ const result = [ // => [4, -1] ``` -Try this R.lastIndexOf example in Rambda REPL +Try this R.lastIndexOf example in Rambda REPL
@@ -5903,7 +5903,7 @@ const result = R.map(fn)(iterable), // => [2, 4] ``` -Try this R.map example in Rambda REPL +Try this R.map example in Rambda REPL
@@ -6022,7 +6022,7 @@ const result = await R.mapAsync(fn)([1, 2, 3]) // `result` resolves after 3 seconds to `[2, 3, 4]` ``` -Try this R.mapAsync example in Rambda REPL +Try this R.mapAsync example in Rambda REPL
@@ -6166,7 +6166,7 @@ const result = R.mapKeys( // => { A1: 1, B2: 2 } ``` -Try this R.mapKeys example in Rambda REPL +Try this R.mapKeys example in Rambda REPL
@@ -6257,7 +6257,7 @@ const result = R.mapObject(fn)(obj) // => {a: 'a-1', b: 'b-2'} ``` -Try this R.mapObject example in Rambda REPL +Try this R.mapObject example in Rambda REPL
@@ -6493,22 +6493,22 @@ it('R.mapObjectAsync', async () => { ```typescript mapParallelAsync( - fn: (value: T[number], index: number) => Promise, + fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise> ``` Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`. +There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts.
All TypeScript definitions ```typescript -mapParallelAsync( - fn: (value: T[number], index: number) => Promise, -): (data: T) => Promise>; mapParallelAsync( fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise>; ``` @@ -6519,8 +6519,18 @@ mapParallelAsync( R.mapParallelAsync source ```javascript -export function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) +export function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = [] + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize) + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))) + result.push(...batchResult) + } + return result + } } ``` @@ -6556,6 +6566,17 @@ test('pipeAsync', async () => { ) expect(result).toEqual([ 2,3,4 ]) }) + +test('with batchSize', async () => { + const fn = async (x, i) => { + await delay(100) + return `${x}:${i}` + } + const result = await mapParallelAsync(fn, 2)([1, 2, 3, 4, 5]) + expect(result).toEqual( + ['1:0', '2:1', '3:2', '4:3', '5:4'] + ) +}) ```
@@ -6566,46 +6587,53 @@ test('pipeAsync', async () => { ```typescript -mapPropObject( - valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], - ) => Value, - prop: K, +mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, ): (data: T) => T[K] extends ReadonlyArray - ? MergeTypes & { [P in K]: Value[] }> - : never + ? MergeTypes & { [P in K]: Value[] }> + : never ``` -It maps over a property of object that is a list. +Convenience method, when one needs to maps over a object property that is a list. ```javascript const result = pipe( { a: [1,2,3], b: 'foo' }, - mapPropObject(x => { - x // $ExpectType { a: number; b: string; } + mapPropObject('a',x => { return { a: x, flag: x > 2, } - }, 'a'), + }), ) // => { a: [{ a: 1, flag: false },{ a: 2, flag: false }, { a: 3, flag: true }], b: 'foo' } ``` -Try this R.mapPropObject example in Rambda REPL +Try this R.mapPropObject example in Rambda REPL
All TypeScript definitions ```typescript -mapPropObject( +mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, +): (data: T) => T[K] extends ReadonlyArray + ? MergeTypes & { [P in K]: Value[] }> + : never; +mapPropObject( + prop: K, valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], + listItem: T[K] extends ReadonlyArray ? ElementType : never, ) => Value, - prop: K, ): (data: T) => T[K] extends ReadonlyArray ? MergeTypes & { [P in K]: Value[] }> : never; @@ -6664,24 +6692,52 @@ it('happy', () => { TypeScript test ```typescript -import { mapPropObject, pipe } from 'rambda' +import { map, mapPropObject, pipe } from 'rambda' describe('R.mapPropObject', () => { it('iterable with one arguments', () => { const result = pipe( { a: [1,2,3], b: 'foo' }, - mapPropObject(x => { + mapPropObject('a', x => { x // $ExpectType number return { a: x, flag: x > 2, } - }, 'a'), + }), ) result.a // $ExpectType { a: number; flag: boolean; }[] result.b // $ExpectType string }) + + it('iterable with two arguments', () => { + const result = pipe( + { a: [1,2,3], b: 'foo' }, + mapPropObject('a', (x, list) => { + x // $ExpectType number + list // $ExpectType number[] + return list.length + }), + ) + result.a // $ExpectType number[] + result.b // $ExpectType string + }) + + it('more complex example', () => { + const result = pipe( + [{a:[true, false, true], b: 'foo'}], + map( + mapPropObject( 'a',(a) => { + a // $ExpectType boolean + return {a, b: 2} + }) + ) + ) + + result[0].a[0].a // $ExpectType boolean + result[0].a[0].b // $ExpectType number + }) }) ``` @@ -6706,7 +6762,7 @@ const result = [ // => [[], ['ba', 'na', 'na']] ``` -Try this R.match example in Rambda REPL +Try this R.match example in Rambda REPL
@@ -6792,7 +6848,7 @@ const compareFn = Math.abs R.maxBy(compareFn, 5, -7) // => -7 ``` -Try this R.maxBy example in Rambda REPL +Try this R.maxBy example in Rambda REPL
@@ -6975,7 +7031,7 @@ const compareFn = Math.abs R.minBy(compareFn, -5, 2) // => -5 ``` -Try this R.minBy example in Rambda REPL +Try this R.minBy example in Rambda REPL
@@ -7032,7 +7088,7 @@ const result = R.pipe( ) // => [1, 3, 3] ``` -Try this R.modifyItemAtIndex example in Rambda REPL +Try this R.modifyItemAtIndex example in Rambda REPL
@@ -7113,7 +7169,7 @@ const result = R.modifyPath('a.b.c', x=> x+1, {a:{b: {c:1}}}) // => {a:{b: {c:2}}} ``` -Try this R.modifyPath example in Rambda REPL +Try this R.modifyPath example in Rambda REPL
@@ -7256,7 +7312,7 @@ const result = R.modifyProp('age', x => x + 1)(person) // => {name: 'foo', age: 21} ``` -Try this R.modifyProp example in Rambda REPL +Try this R.modifyProp example in Rambda REPL
@@ -7379,7 +7435,7 @@ const result = R.none(predicate)(arr) // => true ``` -Try this R.none example in Rambda REPL +Try this R.none example in Rambda REPL
@@ -7475,7 +7531,7 @@ const result = objectIncludes(specification)(input) // => true ``` -Try this R.objectIncludes example in Rambda REPL +Try this R.objectIncludes example in Rambda REPL
@@ -7599,7 +7655,7 @@ const result = R.objOf('foo')('bar') // => {foo: 'bar'} ``` -Try this R.objOf example in Rambda REPL +Try this R.objOf example in Rambda REPL
@@ -7685,7 +7741,7 @@ const result = [ // => [{b: 2}, {b: 2}] ``` -Try this R.omit example in Rambda REPL +Try this R.omit example in Rambda REPL
@@ -7827,7 +7883,7 @@ const expected = [[3], [1, 2]] // `result` is equal to `expected` ``` -Try this R.partition example in Rambda REPL +Try this R.partition example in Rambda REPL
@@ -7952,7 +8008,7 @@ const expected = [{c: 3}, {a: 1, b: 2}] // `result` is equal to `expected` ``` -Try this R.partitionObject example in Rambda REPL +Try this R.partitionObject example in Rambda REPL
@@ -8096,7 +8152,7 @@ const result = [ // => [1, 1, undefined] ``` -Try this R.path example in Rambda REPL +Try this R.path example in Rambda REPL
@@ -8252,7 +8308,7 @@ const result = R.pathSatisfies( // => true ``` -Try this R.pathSatisfies example in Rambda REPL +Try this R.pathSatisfies example in Rambda REPL
@@ -8372,7 +8428,7 @@ const result = R.permutations( // => [[1, 2], [2, 1]] ``` -Try this R.permutations example in Rambda REPL +Try this R.permutations example in Rambda REPL
@@ -8475,7 +8531,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.pick example in Rambda REPL +Try this R.pick example in Rambda REPL
@@ -8614,7 +8670,7 @@ const result = R.pipe( // => [20, 30] ``` -Try this R.pipe example in Rambda REPL +Try this R.pipe example in Rambda REPL
@@ -8967,7 +9023,7 @@ const result = await R.pipeAsync( // `result` resolves to `RAMBDAX_DELAY104` ``` -Try this R.pipeAsync example in Rambda REPL +Try this R.pipeAsync example in Rambda REPL
@@ -9083,7 +9139,7 @@ const result = R.pluck(property)(list) // => [1, 2] ``` -Try this R.pluck example in Rambda REPL +Try this R.pluck example in Rambda REPL
@@ -9189,7 +9245,7 @@ const result = R.prepend('foo', ['bar', 'baz']) // => ['foo', 'bar', 'baz'] ``` -Try this R.prepend example in Rambda REPL +Try this R.prepend example in Rambda REPL
@@ -9253,7 +9309,7 @@ const result = [ // => [100, undefined] ``` -Try this R.prop example in Rambda REPL +Try this R.prop example in Rambda REPL
@@ -9327,7 +9383,7 @@ const result = [ // => [true, false] ``` -Try this R.propEq example in Rambda REPL +Try this R.propEq example in Rambda REPL
@@ -9413,7 +9469,7 @@ const result = [ // => [1, 'DEFAULT_VALUE'] ``` -Try this R.propOr example in Rambda REPL +Try this R.propOr example in Rambda REPL
@@ -9501,7 +9557,7 @@ const result = R.propSatisfies(predicate, property, obj) // => true ``` -Try this R.propSatisfies example in Rambda REPL +Try this R.propSatisfies example in Rambda REPL
@@ -9588,7 +9644,7 @@ If `start` is greater than `end`, then the result will be in descending order. // => [[0, 1, 2, 3, 4], [5, 4, 3, 2, 1]] ``` -Try this R.range example in Rambda REPL +Try this R.range example in Rambda REPL
@@ -9695,7 +9751,7 @@ const result = R.reduce(reducer, initialValue, list) // => 60 ``` -Try this R.reduce example in Rambda REPL +Try this R.reduce example in Rambda REPL
@@ -9816,7 +9872,7 @@ const result = [ // => [[1], {a: 1}] ``` -Try this R.reject example in Rambda REPL +Try this R.reject example in Rambda REPL
@@ -9969,7 +10025,7 @@ const result = R.rejectObject( // => {b: 2} ``` -Try this R.rejectObject example in Rambda REPL +Try this R.rejectObject example in Rambda REPL
@@ -10075,7 +10131,7 @@ const result = [ // => ['f|1|o', 'f|1||1|'] ``` -Try this R.replace example in Rambda REPL +Try this R.replace example in Rambda REPL
@@ -10158,7 +10214,7 @@ const result = [ // => 'f|1||1|' ``` -Try this R.replaceAll example in Rambda REPL +Try this R.replaceAll example in Rambda REPL
@@ -10250,7 +10306,7 @@ const result = R.shuffle( // => [3, 1, 2] or [2, 3, 1] or ... ``` -Try this R.shuffle example in Rambda REPL +Try this R.shuffle example in Rambda REPL
@@ -10335,7 +10391,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sort example in Rambda REPL +Try this R.sort example in Rambda REPL
@@ -10442,7 +10498,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortBy example in Rambda REPL +Try this R.sortBy example in Rambda REPL
@@ -10542,7 +10598,7 @@ describe('R.sortBy', () => { ```typescript -sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[] +sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[] ``` ```javascript @@ -10562,14 +10618,14 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortByDescending example in Rambda REPL +Try this R.sortByDescending example in Rambda REPL
All TypeScript definitions ```typescript -sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; +sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[]; ```
@@ -10588,6 +10644,24 @@ export function sortByDescending(sortFn) {
+
+ +Tests + +```javascript +import { sortByDescending } from './sortByDescending.js' +import { path } from './path.js' + +const list = [{ a: { b: 3 } }, { a: { b: 1 } }, { a: { b: 2 } }] +const sorted = [{ a: { b: 3 } }, { a: { b: 2 } }, { a: { b: 1 } }] + +test('happy', () => { + expect(sortByDescending(path('a.b'))(list)).toEqual(sorted) +}) +``` + +
+ [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sortByDescending) ### sortByPath @@ -10616,7 +10690,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortByPath example in Rambda REPL +Try this R.sortByPath example in Rambda REPL
@@ -10737,7 +10811,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortByPathDescending example in Rambda REPL +Try this R.sortByPathDescending example in Rambda REPL
@@ -10816,7 +10890,7 @@ const result = R.sortObject(predicate)({a:1, b: 4, c: 2}) // => {b: 4, c: 2, a: 1} ``` -Try this R.sortObject example in Rambda REPL +Try this R.sortObject example in Rambda REPL
@@ -10963,7 +11037,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortWith example in Rambda REPL +Try this R.sortWith example in Rambda REPL
@@ -11188,7 +11262,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.splitEvery example in Rambda REPL +Try this R.splitEvery example in Rambda REPL
@@ -11279,7 +11353,7 @@ const result = R.symmetricDifference(x)(y) // => [ 1, 2, 5, 6 ] ``` -Try this R.symmetricDifference example in Rambda REPL +Try this R.symmetricDifference example in Rambda REPL
@@ -11376,7 +11450,7 @@ const result = [ // => [[2, 3], 'oo'] ``` -Try this R.tail example in Rambda REPL +Try this R.tail example in Rambda REPL
@@ -11475,7 +11549,7 @@ const result = [ // => [[1, 2], 'fo'] ``` -Try this R.take example in Rambda REPL +Try this R.take example in Rambda REPL
@@ -11568,7 +11642,7 @@ const result = [ // => [[2, 3], 'ar'] ``` -Try this R.takeLast example in Rambda REPL +Try this R.takeLast example in Rambda REPL
@@ -11656,7 +11730,7 @@ const result = R.takeLastWhile(x => x > 2)([1, 2, 3, 4]) // => [3, 4] ``` -Try this R.takeLastWhile example in Rambda REPL +Try this R.takeLastWhile example in Rambda REPL
@@ -11745,7 +11819,7 @@ const result = R.takeWhile(predicate)(list) // => [1, 2] ``` -Try this R.takeWhile example in Rambda REPL +Try this R.takeWhile example in Rambda REPL
@@ -11855,7 +11929,7 @@ const result = R.pipe( // => `2` and `3` will be logged ``` -Try this R.tap example in Rambda REPL +Try this R.tap example in Rambda REPL
@@ -11899,7 +11973,7 @@ R.test(/^f/)('foo') // => true ``` -Try this R.test example in Rambda REPL +Try this R.test example in Rambda REPL
@@ -11977,7 +12051,7 @@ const result = R.transformPropObject(fn, 'a')(obj) // => {a: false, b: 2} ``` -Try this R.transformPropObject example in Rambda REPL +Try this R.transformPropObject example in Rambda REPL
@@ -12038,7 +12112,7 @@ const result = [ // => [false, 'bar'] ``` -Try this R.tryCatch example in Rambda REPL +Try this R.tryCatch example in Rambda REPL
@@ -12169,7 +12243,7 @@ const delay = ms => new Promise(resolve => { R.type(delay) // => 'Promise' ``` -Try this R.type example in Rambda REPL +Try this R.type example in Rambda REPL
@@ -12419,7 +12493,7 @@ const result = R.union([1,2,3])([3,4,5]); // => [1, 2, 3, 4, 5] ``` -Try this R.union example in Rambda REPL +Try this R.union example in Rambda REPL
@@ -12528,7 +12602,7 @@ R.uniq(list) // => [1, {a: 1}, {a: 2}] ``` -Try this R.uniq example in Rambda REPL +Try this R.uniq example in Rambda REPL
@@ -12635,7 +12709,7 @@ const result = R.uniqBy(x => x)(list) // => [{a:1}, {a:2}] ``` -Try this R.uniqBy example in Rambda REPL +Try this R.uniqBy example in Rambda REPL
@@ -12741,7 +12815,7 @@ const result = R.uniqWith(predicate)(list) // => `result` is equal to `expected` ``` -Try this R.uniqWith example in Rambda REPL +Try this R.uniqWith example in Rambda REPL
@@ -12892,7 +12966,7 @@ const result = [ // => [11, 5] ``` -Try this R.unless example in Rambda REPL +Try this R.unless example in Rambda REPL
@@ -13007,7 +13081,7 @@ const expected = [{a:1, b:2}, {a:1, b:3}] // => `result` is equal to `expected` ``` -Try this R.unwind example in Rambda REPL +Try this R.unwind example in Rambda REPL
@@ -13116,7 +13190,7 @@ const result = R.update(index, newValue)(list) // => [1, 2, 88, 4, 5] ``` -Try this R.update example in Rambda REPL +Try this R.update example in Rambda REPL
@@ -13217,7 +13291,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.when example in Rambda REPL +Try this R.when example in Rambda REPL
@@ -13335,7 +13409,7 @@ R.zip([...x, 3])(['A', 'B']) // => [[1, 'A'], [2, 'B']] ``` -Try this R.zip example in Rambda REPL +Try this R.zip example in Rambda REPL
@@ -13453,7 +13527,7 @@ const result = R.zipWith((x, y) => x + y, list1)(list2) // => [110, 220] ``` -Try this R.zipWith example in Rambda REPL +Try this R.zipWith example in Rambda REPL
@@ -13542,6 +13616,14 @@ describe('R.zipWith', () => { ## ❯ CHANGELOG +10.3.4 + +- Fix wrong typing for `R.sortByDescending` - [Issue #797](https://github.com/selfrefactor/rambda/issues/797) + +- Improve `R.mapParallelAsync` typings to allow optional `batchSize` parameter. + +- Change order of inputs in `R.mapPropObject` + 10.3.3 - Fix wrong typing for `R.reject` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779) diff --git a/deno.json b/deno.json index 0efb4ed4..8a8cddbf 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@rambda/rambda", - "version": "10.3.3", + "version": "10.3.4", "exports": "./mod.ts", "imports": { "rambda": "./mod.ts" diff --git a/dist/rambda.cjs b/dist/rambda.cjs index f353c2aa..1cf98995 100644 --- a/dist/rambda.cjs +++ b/dist/rambda.cjs @@ -1044,8 +1044,18 @@ function mapObjectAsync(fn) { } } -function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) +function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = []; + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize); + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))); + result.push(...batchResult); + } + return result + } } function mapPropObject(fn, prop) { diff --git a/dist/rambda.js b/dist/rambda.js index 8bb98b3a..cb7bccb9 100644 --- a/dist/rambda.js +++ b/dist/rambda.js @@ -1042,8 +1042,18 @@ function mapObjectAsync(fn) { } } -function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) +function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = []; + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize); + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))); + result.push(...batchResult); + } + return result + } } function mapPropObject(fn, prop) { diff --git a/dist/rambda.umd.js b/dist/rambda.umd.js index 0d35ec22..777dc450 100644 --- a/dist/rambda.umd.js +++ b/dist/rambda.umd.js @@ -1048,8 +1048,18 @@ } } - function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) + function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = []; + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize); + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))); + result.push(...batchResult); + } + return result + } } function mapPropObject(fn, prop) { diff --git a/docs/README.md b/docs/README.md index eebbe342..927e5c96 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ const result = pipe( //=> [6, 8] ``` -You can test this example in Rambda's REPL +You can test this example in Rambda's REPL * [API](#api) * [Changelog](#-changelog) @@ -183,7 +183,7 @@ const result = R.pipe( // => { a: 1, b: 'foo', c: 3 } ``` -Try this R.addProp example in Rambda REPL +Try this R.addProp example in Rambda REPL
@@ -278,7 +278,7 @@ const result = R.pipe( // => [{a: 1, b: 2, c: '3'}, {a: 3, b: 4, c: '7'}] ``` -Try this R.addPropToObjects example in Rambda REPL +Try this R.addPropToObjects example in Rambda REPL
@@ -393,7 +393,7 @@ const result = R.pipe( ) // => true ``` -Try this R.all example in Rambda REPL +Try this R.all example in Rambda REPL
@@ -491,7 +491,7 @@ const result = R.pipe( ) // => [[1, 2, 3, 4]] ``` -Try this R.allPass example in Rambda REPL +Try this R.allPass example in Rambda REPL
@@ -591,7 +591,7 @@ R.any(predicate)(list) // => true ``` -Try this R.any example in Rambda REPL +Try this R.any example in Rambda REPL
@@ -688,7 +688,7 @@ const result = fn(input) // => true ``` -Try this R.anyPass example in Rambda REPL +Try this R.anyPass example in Rambda REPL
@@ -838,7 +838,7 @@ const result = R.append('foo')(['bar', 'baz']) // => ['bar', 'baz', 'foo'] ``` -Try this R.append example in Rambda REPL +Try this R.append example in Rambda REPL
@@ -930,7 +930,7 @@ const result = R.pipe( // => [{a: 0}, {a: 1}, {a: 2}] ``` -Try this R.ascend example in Rambda REPL +Try this R.ascend example in Rambda REPL
@@ -1136,7 +1136,7 @@ const result = condition(input) // => true ``` -Try this R.checkObjectWithSpec example in Rambda REPL +Try this R.checkObjectWithSpec example in Rambda REPL
@@ -1272,7 +1272,7 @@ const result = R.pipe( // => { a: ['a', 'b', 'c'], b: [1, 2, 3], c: { a: 1, b: 2, c: 0, f: false } } ``` -Try this R.compact example in Rambda REPL +Try this R.compact example in Rambda REPL
@@ -1392,7 +1392,7 @@ const result = [ ] => [ true, false ] ``` -Try this R.complement example in Rambda REPL +Try this R.complement example in Rambda REPL
@@ -1473,7 +1473,7 @@ R.concat([1, 2])([3, 4]) // => [1, 2, 3, 4] R.concat('foo')('bar') // => 'foobar' ``` -Try this R.concat example in Rambda REPL +Try this R.concat example in Rambda REPL
@@ -1592,7 +1592,7 @@ const result = R.count(x => x.a !== undefined)(list) // => 2 ``` -Try this R.count example in Rambda REPL +Try this R.count example in Rambda REPL
@@ -1683,7 +1683,7 @@ const expected = { a: 2, b: 2, c: 2 } // => `result` is equal to `expected` ``` -Try this R.countBy example in Rambda REPL +Try this R.countBy example in Rambda REPL
@@ -1781,7 +1781,7 @@ const result = R.createObjectFromKeys( // => {a: 'a-0', b: 'b-1', c: 'c-2'} ``` -Try this R.createObjectFromKeys example in Rambda REPL +Try this R.createObjectFromKeys example in Rambda REPL
@@ -1857,7 +1857,7 @@ R.defaultTo('foo'))(undefined) // => 'foo' R.defaultTo('foo')('') // => 'foo' ``` -Try this R.defaultTo example in Rambda REPL +Try this R.defaultTo example in Rambda REPL
@@ -1956,7 +1956,7 @@ const result = R.pipe( // => [{a: 2}, {a: 1}, {a: 0}] ``` -Try this R.descend example in Rambda REPL +Try this R.descend example in Rambda REPL
@@ -2002,7 +2002,7 @@ It returns `howMany` items dropped from beginning of list. R.drop(2)(['foo', 'bar', 'baz']) // => ['baz'] ``` -Try this R.drop example in Rambda REPL +Try this R.drop example in Rambda REPL
@@ -2135,7 +2135,7 @@ const result = dropLastWhile(predicate)(list); // => [1, 2] ``` -Try this R.dropLastWhile example in Rambda REPL +Try this R.dropLastWhile example in Rambda REPL
@@ -2219,7 +2219,7 @@ const result = R.dropRepeatsBy( // => [1, 2, 3] ``` -Try this R.dropRepeatsBy example in Rambda REPL +Try this R.dropRepeatsBy example in Rambda REPL
@@ -2247,7 +2247,7 @@ const result = R.dropRepeatsWith(R.prop('a'))(list) // => [{a:1,b:2}, {a:2, b:4}] ``` -Try this R.dropRepeatsWith example in Rambda REPL +Try this R.dropRepeatsWith example in Rambda REPL
@@ -2275,7 +2275,7 @@ const result = R.dropWhile(predicate)(list) // => [3, 4] ``` -Try this R.dropWhile example in Rambda REPL +Try this R.dropWhile example in Rambda REPL
@@ -2394,7 +2394,7 @@ const result = R.duplicateBy(x => x, list) // => [{a:1}] ``` -Try this R.duplicateBy example in Rambda REPL +Try this R.duplicateBy example in Rambda REPL
@@ -2462,7 +2462,7 @@ const result = R.eqBy(Math.abs, 5)(-5) // => true ``` -Try this R.eqBy example in Rambda REPL +Try this R.eqBy example in Rambda REPL
@@ -2531,7 +2531,7 @@ const result = R.eqProps('a', obj1)(obj2) // => true ``` -Try this R.eqProps example in Rambda REPL +Try this R.eqProps example in Rambda REPL
@@ -2630,7 +2630,7 @@ R.equals( ) // => true ``` -Try this R.equals example in Rambda REPL +Try this R.equals example in Rambda REPL
@@ -3122,7 +3122,7 @@ const result = R.pipe( // => result is { foo: 3, baz: 'baz' } ``` -Try this R.evolve example in Rambda REPL +Try this R.evolve example in Rambda REPL
@@ -3228,7 +3228,7 @@ const result = [ // => [true, true ] ``` -Try this R.excludes example in Rambda REPL +Try this R.excludes example in Rambda REPL
@@ -3321,7 +3321,7 @@ const result = R.filter(predicate)(list) // => [2, 3] ``` -Try this R.filter example in Rambda REPL +Try this R.filter example in Rambda REPL
@@ -3583,7 +3583,7 @@ const result = R.filterObject( // => {a: 1, c: 3} ``` -Try this R.filterObject example in Rambda REPL +Try this R.filterObject example in Rambda REPL
@@ -3691,7 +3691,7 @@ const result = R.find(predicate)(list) // => {foo: 1} ``` -Try this R.find example in Rambda REPL +Try this R.find example in Rambda REPL
@@ -3795,7 +3795,7 @@ const result = R.findIndex(predicate)(list) // => 1 ``` -Try this R.findIndex example in Rambda REPL +Try this R.findIndex example in Rambda REPL
@@ -3890,7 +3890,7 @@ const result = R.findLast(predicate)(list) // => {foo: 1} ``` -Try this R.findLast example in Rambda REPL +Try this R.findLast example in Rambda REPL
@@ -3945,7 +3945,7 @@ const result = R.findLastIndex(predicate)(list) // => 1 ``` -Try this R.findLastIndex example in Rambda REPL +Try this R.findLastIndex example in Rambda REPL
@@ -4034,7 +4034,7 @@ const result = R.findNth(predicate, 2)(list) // => {foo: 2} ``` -Try this R.findNth example in Rambda REPL +Try this R.findNth example in Rambda REPL
@@ -4112,7 +4112,7 @@ const result = R.flatMap(duplicate)(list) // => [ 1, 1, 2, 2, 3, 3 ] ``` -Try this R.flatMap example in Rambda REPL +Try this R.flatMap example in Rambda REPL
@@ -4233,7 +4233,7 @@ const result = R.flatten([ // => [ 1, 2, 3, 30, 300, 4 ] ``` -Try this R.flatten example in Rambda REPL +Try this R.flatten example in Rambda REPL
@@ -4331,7 +4331,7 @@ const result = R.flattenObject( // => [3, 1, 2] or [2, 3, 1] or ... ``` -Try this R.flattenObject example in Rambda REPL +Try this R.flattenObject example in Rambda REPL
@@ -4555,7 +4555,7 @@ const result = R.groupBy(groupFn, list) // => { '1': ['a', 'b'], '2': ['aa', 'bb'] } ``` -Try this R.groupBy example in Rambda REPL +Try this R.groupBy example in Rambda REPL
@@ -4672,7 +4672,7 @@ const result = [ // => [1, 'f'] ``` -Try this R.head example in Rambda REPL +Try this R.head example in Rambda REPL
@@ -4795,7 +4795,7 @@ const result = [ // => [true, true ] ``` -Try this R.includes example in Rambda REPL +Try this R.includes example in Rambda REPL
@@ -4927,7 +4927,7 @@ const result = R.indexBy( // => {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} ``` -Try this R.indexBy example in Rambda REPL +Try this R.indexBy example in Rambda REPL
@@ -5029,7 +5029,7 @@ const result = [ // => [0, 1] ``` -Try this R.indexOf example in Rambda REPL +Try this R.indexOf example in Rambda REPL
@@ -5129,7 +5129,7 @@ const result = [ // => [[1, 2], 'fo'] ``` -Try this R.init example in Rambda REPL +Try this R.init example in Rambda REPL
@@ -5235,7 +5235,7 @@ const result = R.innerJoin(predicate, list1)(list2) // => [4, 5] ``` -Try this R.innerJoin example in Rambda REPL +Try this R.innerJoin example in Rambda REPL
@@ -5357,7 +5357,7 @@ const expected = 'foo is BAR even 1 more' // => `result` is equal to `expected` ``` -Try this R.interpolate example in Rambda REPL +Try this R.interpolate example in Rambda REPL
@@ -5466,7 +5466,7 @@ const result = R.intersection(listA)(listB) // => [{ id : 3 }, { id : 4 }] ``` -Try this R.intersection example in Rambda REPL +Try this R.intersection example in Rambda REPL
@@ -5561,7 +5561,7 @@ const result = R.intersperse(separator)(list) // => [0, 10, 1, 10, 2, 10, 3] ``` -Try this R.intersperse example in Rambda REPL +Try this R.intersperse example in Rambda REPL
@@ -5656,7 +5656,7 @@ It returns a string of all `list` instances joined with a `glue`. R.join('-', [1, 2, 3]) // => '1-2-3' ``` -Try this R.join example in Rambda REPL +Try this R.join example in Rambda REPL
@@ -5721,7 +5721,7 @@ const result = [ // => [3, 'o'] ``` -Try this R.last example in Rambda REPL +Try this R.last example in Rambda REPL
@@ -5800,7 +5800,7 @@ const result = [ // => [4, -1] ``` -Try this R.lastIndexOf example in Rambda REPL +Try this R.lastIndexOf example in Rambda REPL
@@ -5903,7 +5903,7 @@ const result = R.map(fn)(iterable), // => [2, 4] ``` -Try this R.map example in Rambda REPL +Try this R.map example in Rambda REPL
@@ -6022,7 +6022,7 @@ const result = await R.mapAsync(fn)([1, 2, 3]) // `result` resolves after 3 seconds to `[2, 3, 4]` ``` -Try this R.mapAsync example in Rambda REPL +Try this R.mapAsync example in Rambda REPL
@@ -6166,7 +6166,7 @@ const result = R.mapKeys( // => { A1: 1, B2: 2 } ``` -Try this R.mapKeys example in Rambda REPL +Try this R.mapKeys example in Rambda REPL
@@ -6257,7 +6257,7 @@ const result = R.mapObject(fn)(obj) // => {a: 'a-1', b: 'b-2'} ``` -Try this R.mapObject example in Rambda REPL +Try this R.mapObject example in Rambda REPL
@@ -6493,22 +6493,22 @@ it('R.mapObjectAsync', async () => { ```typescript mapParallelAsync( - fn: (value: T[number], index: number) => Promise, + fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise> ``` Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`. +There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts.
All TypeScript definitions ```typescript -mapParallelAsync( - fn: (value: T[number], index: number) => Promise, -): (data: T) => Promise>; mapParallelAsync( fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise>; ``` @@ -6519,8 +6519,18 @@ mapParallelAsync( R.mapParallelAsync source ```javascript -export function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) +export function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = [] + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize) + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))) + result.push(...batchResult) + } + return result + } } ``` @@ -6556,6 +6566,17 @@ test('pipeAsync', async () => { ) expect(result).toEqual([ 2,3,4 ]) }) + +test('with batchSize', async () => { + const fn = async (x, i) => { + await delay(100) + return `${x}:${i}` + } + const result = await mapParallelAsync(fn, 2)([1, 2, 3, 4, 5]) + expect(result).toEqual( + ['1:0', '2:1', '3:2', '4:3', '5:4'] + ) +}) ```
@@ -6566,46 +6587,53 @@ test('pipeAsync', async () => { ```typescript -mapPropObject( - valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], - ) => Value, - prop: K, +mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, ): (data: T) => T[K] extends ReadonlyArray - ? MergeTypes & { [P in K]: Value[] }> - : never + ? MergeTypes & { [P in K]: Value[] }> + : never ``` -It maps over a property of object that is a list. +Convenience method, when one needs to maps over a object property that is a list. ```javascript const result = pipe( { a: [1,2,3], b: 'foo' }, - mapPropObject(x => { - x // $ExpectType { a: number; b: string; } + mapPropObject('a',x => { return { a: x, flag: x > 2, } - }, 'a'), + }), ) // => { a: [{ a: 1, flag: false },{ a: 2, flag: false }, { a: 3, flag: true }], b: 'foo' } ``` -Try this R.mapPropObject example in Rambda REPL +Try this R.mapPropObject example in Rambda REPL
All TypeScript definitions ```typescript -mapPropObject( +mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, +): (data: T) => T[K] extends ReadonlyArray + ? MergeTypes & { [P in K]: Value[] }> + : never; +mapPropObject( + prop: K, valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], + listItem: T[K] extends ReadonlyArray ? ElementType : never, ) => Value, - prop: K, ): (data: T) => T[K] extends ReadonlyArray ? MergeTypes & { [P in K]: Value[] }> : never; @@ -6664,24 +6692,52 @@ it('happy', () => { TypeScript test ```typescript -import { mapPropObject, pipe } from 'rambda' +import { map, mapPropObject, pipe } from 'rambda' describe('R.mapPropObject', () => { it('iterable with one arguments', () => { const result = pipe( { a: [1,2,3], b: 'foo' }, - mapPropObject(x => { + mapPropObject('a', x => { x // $ExpectType number return { a: x, flag: x > 2, } - }, 'a'), + }), ) result.a // $ExpectType { a: number; flag: boolean; }[] result.b // $ExpectType string }) + + it('iterable with two arguments', () => { + const result = pipe( + { a: [1,2,3], b: 'foo' }, + mapPropObject('a', (x, list) => { + x // $ExpectType number + list // $ExpectType number[] + return list.length + }), + ) + result.a // $ExpectType number[] + result.b // $ExpectType string + }) + + it('more complex example', () => { + const result = pipe( + [{a:[true, false, true], b: 'foo'}], + map( + mapPropObject( 'a',(a) => { + a // $ExpectType boolean + return {a, b: 2} + }) + ) + ) + + result[0].a[0].a // $ExpectType boolean + result[0].a[0].b // $ExpectType number + }) }) ``` @@ -6706,7 +6762,7 @@ const result = [ // => [[], ['ba', 'na', 'na']] ``` -Try this R.match example in Rambda REPL +Try this R.match example in Rambda REPL
@@ -6792,7 +6848,7 @@ const compareFn = Math.abs R.maxBy(compareFn, 5, -7) // => -7 ``` -Try this R.maxBy example in Rambda REPL +Try this R.maxBy example in Rambda REPL
@@ -6975,7 +7031,7 @@ const compareFn = Math.abs R.minBy(compareFn, -5, 2) // => -5 ``` -Try this R.minBy example in Rambda REPL +Try this R.minBy example in Rambda REPL
@@ -7032,7 +7088,7 @@ const result = R.pipe( ) // => [1, 3, 3] ``` -Try this R.modifyItemAtIndex example in Rambda REPL +Try this R.modifyItemAtIndex example in Rambda REPL
@@ -7113,7 +7169,7 @@ const result = R.modifyPath('a.b.c', x=> x+1, {a:{b: {c:1}}}) // => {a:{b: {c:2}}} ``` -Try this R.modifyPath example in Rambda REPL +Try this R.modifyPath example in Rambda REPL
@@ -7256,7 +7312,7 @@ const result = R.modifyProp('age', x => x + 1)(person) // => {name: 'foo', age: 21} ``` -Try this R.modifyProp example in Rambda REPL +Try this R.modifyProp example in Rambda REPL
@@ -7379,7 +7435,7 @@ const result = R.none(predicate)(arr) // => true ``` -Try this R.none example in Rambda REPL +Try this R.none example in Rambda REPL
@@ -7475,7 +7531,7 @@ const result = objectIncludes(specification)(input) // => true ``` -Try this R.objectIncludes example in Rambda REPL +Try this R.objectIncludes example in Rambda REPL
@@ -7599,7 +7655,7 @@ const result = R.objOf('foo')('bar') // => {foo: 'bar'} ``` -Try this R.objOf example in Rambda REPL +Try this R.objOf example in Rambda REPL
@@ -7685,7 +7741,7 @@ const result = [ // => [{b: 2}, {b: 2}] ``` -Try this R.omit example in Rambda REPL +Try this R.omit example in Rambda REPL
@@ -7827,7 +7883,7 @@ const expected = [[3], [1, 2]] // `result` is equal to `expected` ``` -Try this R.partition example in Rambda REPL +Try this R.partition example in Rambda REPL
@@ -7952,7 +8008,7 @@ const expected = [{c: 3}, {a: 1, b: 2}] // `result` is equal to `expected` ``` -Try this R.partitionObject example in Rambda REPL +Try this R.partitionObject example in Rambda REPL
@@ -8096,7 +8152,7 @@ const result = [ // => [1, 1, undefined] ``` -Try this R.path example in Rambda REPL +Try this R.path example in Rambda REPL
@@ -8252,7 +8308,7 @@ const result = R.pathSatisfies( // => true ``` -Try this R.pathSatisfies example in Rambda REPL +Try this R.pathSatisfies example in Rambda REPL
@@ -8372,7 +8428,7 @@ const result = R.permutations( // => [[1, 2], [2, 1]] ``` -Try this R.permutations example in Rambda REPL +Try this R.permutations example in Rambda REPL
@@ -8475,7 +8531,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.pick example in Rambda REPL +Try this R.pick example in Rambda REPL
@@ -8614,7 +8670,7 @@ const result = R.pipe( // => [20, 30] ``` -Try this R.pipe example in Rambda REPL +Try this R.pipe example in Rambda REPL
@@ -8967,7 +9023,7 @@ const result = await R.pipeAsync( // `result` resolves to `RAMBDAX_DELAY104` ``` -Try this R.pipeAsync example in Rambda REPL +Try this R.pipeAsync example in Rambda REPL
@@ -9083,7 +9139,7 @@ const result = R.pluck(property)(list) // => [1, 2] ``` -Try this R.pluck example in Rambda REPL +Try this R.pluck example in Rambda REPL
@@ -9189,7 +9245,7 @@ const result = R.prepend('foo', ['bar', 'baz']) // => ['foo', 'bar', 'baz'] ``` -Try this R.prepend example in Rambda REPL +Try this R.prepend example in Rambda REPL
@@ -9253,7 +9309,7 @@ const result = [ // => [100, undefined] ``` -Try this R.prop example in Rambda REPL +Try this R.prop example in Rambda REPL
@@ -9327,7 +9383,7 @@ const result = [ // => [true, false] ``` -Try this R.propEq example in Rambda REPL +Try this R.propEq example in Rambda REPL
@@ -9413,7 +9469,7 @@ const result = [ // => [1, 'DEFAULT_VALUE'] ``` -Try this R.propOr example in Rambda REPL +Try this R.propOr example in Rambda REPL
@@ -9501,7 +9557,7 @@ const result = R.propSatisfies(predicate, property, obj) // => true ``` -Try this R.propSatisfies example in Rambda REPL +Try this R.propSatisfies example in Rambda REPL
@@ -9588,7 +9644,7 @@ If `start` is greater than `end`, then the result will be in descending order. // => [[0, 1, 2, 3, 4], [5, 4, 3, 2, 1]] ``` -Try this R.range example in Rambda REPL +Try this R.range example in Rambda REPL
@@ -9695,7 +9751,7 @@ const result = R.reduce(reducer, initialValue, list) // => 60 ``` -Try this R.reduce example in Rambda REPL +Try this R.reduce example in Rambda REPL
@@ -9816,7 +9872,7 @@ const result = [ // => [[1], {a: 1}] ``` -Try this R.reject example in Rambda REPL +Try this R.reject example in Rambda REPL
@@ -9969,7 +10025,7 @@ const result = R.rejectObject( // => {b: 2} ``` -Try this R.rejectObject example in Rambda REPL +Try this R.rejectObject example in Rambda REPL
@@ -10075,7 +10131,7 @@ const result = [ // => ['f|1|o', 'f|1||1|'] ``` -Try this R.replace example in Rambda REPL +Try this R.replace example in Rambda REPL
@@ -10158,7 +10214,7 @@ const result = [ // => 'f|1||1|' ``` -Try this R.replaceAll example in Rambda REPL +Try this R.replaceAll example in Rambda REPL
@@ -10250,7 +10306,7 @@ const result = R.shuffle( // => [3, 1, 2] or [2, 3, 1] or ... ``` -Try this R.shuffle example in Rambda REPL +Try this R.shuffle example in Rambda REPL
@@ -10335,7 +10391,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sort example in Rambda REPL +Try this R.sort example in Rambda REPL
@@ -10442,7 +10498,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortBy example in Rambda REPL +Try this R.sortBy example in Rambda REPL
@@ -10542,7 +10598,7 @@ describe('R.sortBy', () => { ```typescript -sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[] +sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[] ``` ```javascript @@ -10562,14 +10618,14 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortByDescending example in Rambda REPL +Try this R.sortByDescending example in Rambda REPL
All TypeScript definitions ```typescript -sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; +sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[]; ```
@@ -10588,6 +10644,24 @@ export function sortByDescending(sortFn) {
+
+ +Tests + +```javascript +import { sortByDescending } from './sortByDescending.js' +import { path } from './path.js' + +const list = [{ a: { b: 3 } }, { a: { b: 1 } }, { a: { b: 2 } }] +const sorted = [{ a: { b: 3 } }, { a: { b: 2 } }, { a: { b: 1 } }] + +test('happy', () => { + expect(sortByDescending(path('a.b'))(list)).toEqual(sorted) +}) +``` + +
+ [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sortByDescending) ### sortByPath @@ -10616,7 +10690,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortByPath example in Rambda REPL +Try this R.sortByPath example in Rambda REPL
@@ -10737,7 +10811,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortByPathDescending example in Rambda REPL +Try this R.sortByPathDescending example in Rambda REPL
@@ -10816,7 +10890,7 @@ const result = R.sortObject(predicate)({a:1, b: 4, c: 2}) // => {b: 4, c: 2, a: 1} ``` -Try this R.sortObject example in Rambda REPL +Try this R.sortObject example in Rambda REPL
@@ -10963,7 +11037,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.sortWith example in Rambda REPL +Try this R.sortWith example in Rambda REPL
@@ -11188,7 +11262,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.splitEvery example in Rambda REPL +Try this R.splitEvery example in Rambda REPL
@@ -11279,7 +11353,7 @@ const result = R.symmetricDifference(x)(y) // => [ 1, 2, 5, 6 ] ``` -Try this R.symmetricDifference example in Rambda REPL +Try this R.symmetricDifference example in Rambda REPL
@@ -11376,7 +11450,7 @@ const result = [ // => [[2, 3], 'oo'] ``` -Try this R.tail example in Rambda REPL +Try this R.tail example in Rambda REPL
@@ -11475,7 +11549,7 @@ const result = [ // => [[1, 2], 'fo'] ``` -Try this R.take example in Rambda REPL +Try this R.take example in Rambda REPL
@@ -11568,7 +11642,7 @@ const result = [ // => [[2, 3], 'ar'] ``` -Try this R.takeLast example in Rambda REPL +Try this R.takeLast example in Rambda REPL
@@ -11656,7 +11730,7 @@ const result = R.takeLastWhile(x => x > 2)([1, 2, 3, 4]) // => [3, 4] ``` -Try this R.takeLastWhile example in Rambda REPL +Try this R.takeLastWhile example in Rambda REPL
@@ -11745,7 +11819,7 @@ const result = R.takeWhile(predicate)(list) // => [1, 2] ``` -Try this R.takeWhile example in Rambda REPL +Try this R.takeWhile example in Rambda REPL
@@ -11855,7 +11929,7 @@ const result = R.pipe( // => `2` and `3` will be logged ``` -Try this R.tap example in Rambda REPL +Try this R.tap example in Rambda REPL
@@ -11899,7 +11973,7 @@ R.test(/^f/)('foo') // => true ``` -Try this R.test example in Rambda REPL +Try this R.test example in Rambda REPL
@@ -11977,7 +12051,7 @@ const result = R.transformPropObject(fn, 'a')(obj) // => {a: false, b: 2} ``` -Try this R.transformPropObject example in Rambda REPL +Try this R.transformPropObject example in Rambda REPL
@@ -12038,7 +12112,7 @@ const result = [ // => [false, 'bar'] ``` -Try this R.tryCatch example in Rambda REPL +Try this R.tryCatch example in Rambda REPL
@@ -12169,7 +12243,7 @@ const delay = ms => new Promise(resolve => { R.type(delay) // => 'Promise' ``` -Try this R.type example in Rambda REPL +Try this R.type example in Rambda REPL
@@ -12419,7 +12493,7 @@ const result = R.union([1,2,3])([3,4,5]); // => [1, 2, 3, 4, 5] ``` -Try this R.union example in Rambda REPL +Try this R.union example in Rambda REPL
@@ -12528,7 +12602,7 @@ R.uniq(list) // => [1, {a: 1}, {a: 2}] ``` -Try this R.uniq example in Rambda REPL +Try this R.uniq example in Rambda REPL
@@ -12635,7 +12709,7 @@ const result = R.uniqBy(x => x)(list) // => [{a:1}, {a:2}] ``` -Try this R.uniqBy example in Rambda REPL +Try this R.uniqBy example in Rambda REPL
@@ -12741,7 +12815,7 @@ const result = R.uniqWith(predicate)(list) // => `result` is equal to `expected` ``` -Try this R.uniqWith example in Rambda REPL +Try this R.uniqWith example in Rambda REPL
@@ -12892,7 +12966,7 @@ const result = [ // => [11, 5] ``` -Try this R.unless example in Rambda REPL +Try this R.unless example in Rambda REPL
@@ -13007,7 +13081,7 @@ const expected = [{a:1, b:2}, {a:1, b:3}] // => `result` is equal to `expected` ``` -Try this R.unwind example in Rambda REPL +Try this R.unwind example in Rambda REPL
@@ -13116,7 +13190,7 @@ const result = R.update(index, newValue)(list) // => [1, 2, 88, 4, 5] ``` -Try this R.update example in Rambda REPL +Try this R.update example in Rambda REPL
@@ -13217,7 +13291,7 @@ const expected = [ // => `result` is equal to `expected` ``` -Try this R.when example in Rambda REPL +Try this R.when example in Rambda REPL
@@ -13335,7 +13409,7 @@ R.zip([...x, 3])(['A', 'B']) // => [[1, 'A'], [2, 'B']] ``` -Try this R.zip example in Rambda REPL +Try this R.zip example in Rambda REPL
@@ -13453,7 +13527,7 @@ const result = R.zipWith((x, y) => x + y, list1)(list2) // => [110, 220] ``` -Try this R.zipWith example in Rambda REPL +Try this R.zipWith example in Rambda REPL
@@ -13542,6 +13616,14 @@ describe('R.zipWith', () => { ## ❯ CHANGELOG +10.3.4 + +- Fix wrong typing for `R.sortByDescending` - [Issue #797](https://github.com/selfrefactor/rambda/issues/797) + +- Improve `R.mapParallelAsync` typings to allow optional `batchSize` parameter. + +- Change order of inputs in `R.mapPropObject` + 10.3.3 - Fix wrong typing for `R.reject` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779) diff --git a/files/DEV_NOTES.md b/files/DEV_NOTES.md index 79a91795..9091b31f 100644 --- a/files/DEV_NOTES.md +++ b/files/DEV_NOTES.md @@ -7,6 +7,31 @@ export function splitEvery(sliceLength: number): { (input: T[]): (T[])[]; }; --- +Suggested new methods for Rambda library: + + +15. `sortByMultiple` - Sort by multiple criteria: +```typescript +export function sortByMultiple( + criteria: Array<(a: T, b: T) => number> +): (list: T[]) => T[]; +``` + +These suggestions are based on: +1. Common use cases in TypeScript projects +2. Working well within `R.pipe` chains +3. Having clear, single-purpose functionality +4. Being type-safe +5. Following the library's focus on object manipulation and array operations +6. Complementing existing methods + +The suggestions avoid methods that: +1. Have confusing or ambiguous behavior +2. Don't work well in pipe chains +3. Have multiple ways to be used +4. Are better suited as part of application code +5. Have complex TypeScript definitions that would be hard to maintain +--- check wrong import from './[a-zA-Z]+' diff --git a/files/NEXT_VERSION_CHECKLIST.md b/files/NEXT_VERSION_CHECKLIST.md deleted file mode 100644 index c98a1b64..00000000 --- a/files/NEXT_VERSION_CHECKLIST.md +++ /dev/null @@ -1,18 +0,0 @@ -=== -ABOVE IS DONE -=== -document scripts - - -ABOVE IS IN PROGRESS -=== -export function maybe(thunk: () => T): T | undefined { - try { - return thunk(); - } catch {} -} -=== -use functor as a word -https://github.com/hemanth/functional-programming-jargon?utm_source=hackernewsletter&utm_medium=email&utm_term=code#functor - -=== diff --git a/files/README_START.md b/files/README_START.md index 80957e15..239fcb0d 100644 --- a/files/README_START.md +++ b/files/README_START.md @@ -21,7 +21,7 @@ const result = pipe( //=> [6, 8] ``` -You can test this example in Rambda's REPL +You can test this example in Rambda's REPL * [API](#api) * [Changelog](#-changelog) diff --git a/files/index.d.ts b/files/index.d.ts index 95580d96..dcc0acb5 100644 --- a/files/index.d.ts +++ b/files/index.d.ts @@ -1050,7 +1050,7 @@ export function transformPropObject( /* Method: mapPropObject -Explanation: It maps over a property of object that is a list. +Explanation: Convenience method, when one needs to maps over a object property that is a list. Example: @@ -1058,13 +1058,12 @@ Example: const result = pipe( { a: [1,2,3], b: 'foo' }, - mapPropObject(x => { - x // $ExpectType { a: number; b: string; } + mapPropObject('a',x => { return { a: x, flag: x > 2, } - }, 'a'), + }), ) // => { a: [{ a: 1, flag: false },{ a: 2, flag: false }, { a: 3, flag: true }], b: 'foo' } ``` @@ -1075,12 +1074,20 @@ Notes: */ // @SINGLE_MARKER -export function mapPropObject( +export function mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, +): (data: T) => T[K] extends ReadonlyArray + ? MergeTypes & { [P in K]: Value[] }> + : never; +export function mapPropObject( + prop: K, valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], + listItem: T[K] extends ReadonlyArray ? ElementType : never, ) => Value, - prop: K, ): (data: T) => T[K] extends ReadonlyArray ? MergeTypes & { [P in K]: Value[] }> : never; @@ -2536,7 +2543,7 @@ Notes: */ // @SINGLE_MARKER -export function sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; +export function sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[]; /* Method: sortByPath @@ -4429,6 +4436,7 @@ export function mapAsync( Method: mapParallelAsync Explanation: Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`. +There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts. Example: @@ -4441,11 +4449,9 @@ Notes: */ // @SINGLE_MARKER -export function mapParallelAsync( - fn: (value: T[number], index: number) => Promise, -): (data: T) => Promise>; export function mapParallelAsync( fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise>; /* diff --git a/index.d.cts b/index.d.cts index 00f365db..3df22af2 100644 --- a/index.d.cts +++ b/index.d.cts @@ -547,23 +547,30 @@ export function mapObjectAsync( /** * Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`. + * There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts. */ -export function mapParallelAsync( - fn: (value: T[number], index: number) => Promise, -): (data: T) => Promise>; export function mapParallelAsync( fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise>; /** - * It maps over a property of object that is a list. + * Convenience method, when one needs to maps over a object property that is a list. */ -export function mapPropObject( +export function mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, +): (data: T) => T[K] extends ReadonlyArray + ? MergeTypes & { [P in K]: Value[] }> + : never; +export function mapPropObject( + prop: K, valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], + listItem: T[K] extends ReadonlyArray ? ElementType : never, ) => Value, - prop: K, ): (data: T) => T[K] extends ReadonlyArray ? MergeTypes & { [P in K]: Value[] }> : never; @@ -1827,7 +1834,7 @@ export function sort(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; */ export function sortBy(sortFn: (x: T) => Ord): (list: T[]) => T[]; -export function sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; +export function sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[]; /** * It sorts `list` by the value of `path` property. diff --git a/index.d.ts b/index.d.ts index 00f365db..3df22af2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -547,23 +547,30 @@ export function mapObjectAsync( /** * Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`. + * There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts. */ -export function mapParallelAsync( - fn: (value: T[number], index: number) => Promise, -): (data: T) => Promise>; export function mapParallelAsync( fn: (value: T[number]) => Promise, + batchSize?: number, ): (data: T) => Promise>; /** - * It maps over a property of object that is a list. + * Convenience method, when one needs to maps over a object property that is a list. */ -export function mapPropObject( +export function mapPropObject( + prop: K, + valueMapper: ( + listItem: T[K] extends ReadonlyArray ? ElementType : never, + list: T[K] extends ReadonlyArray ? T[K] : never, + ) => Value, +): (data: T) => T[K] extends ReadonlyArray + ? MergeTypes & { [P in K]: Value[] }> + : never; +export function mapPropObject( + prop: K, valueMapper: ( - value: T[K] extends ReadonlyArray ? ElementType : never, - data: T[K], + listItem: T[K] extends ReadonlyArray ? ElementType : never, ) => Value, - prop: K, ): (data: T) => T[K] extends ReadonlyArray ? MergeTypes & { [P in K]: Value[] }> : never; @@ -1827,7 +1834,7 @@ export function sort(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; */ export function sortBy(sortFn: (x: T) => Ord): (list: T[]) => T[]; -export function sortByDescending(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; +export function sortByDescending(sortFn: (x: T) => Ord): (list: T[]) => T[]; /** * It sorts `list` by the value of `path` property. diff --git a/jsr.json b/jsr.json deleted file mode 100644 index 4a54711f..00000000 --- a/jsr.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@rambda/rambda", - "version": "10.2.0", - "exports": "./mod.ts", - "imports": { - "rambda": "./mod.ts" - }, - "publish": { - "include": [ - "src", - "rambda.js", - "index.d.ts", - "index.d.cts", - "mod.ts", - "LICENSE.md", - "README.md" - ] - } -} \ No newline at end of file diff --git a/package.json b/package.json index 53ea7b61..e4b8c325 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "test": "vitest run --watch -u", "test:typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source", "create-docsify": "cd ../rambda-scripts && yarn create-docsify", - "deps": "run dep:next", + "deps": "run dep:next 10", + "x": "run dep:stable 10", "ts": "yarn test:typings" }, "niketaScripts": { @@ -40,18 +41,18 @@ "devDependencies": { "@definitelytyped/dtslint": "0.0.182", "@types/mocha": "10.0.10", - "@types/node": "24.7.0", - "@vitest/coverage-v8": "4.0.0-beta.17", + "@types/node": "24.10.1", + "@vitest/coverage-v8": "4.0.10", "helpers-fn": "2.0.0", "lodash": "4.17.21", "radashi": "13.0.0-beta.ffa4778", "rambdax": "11.3.1", - "ramda": "0.31.3", + "ramda": "0.32.0", "remeda": "2.32.0", - "rollup": "4.52.4", + "rollup": "4.53.3", "types-ramda": "0.31.0", - "typescript": "6.0.0-dev.20251006", - "vitest": "4.0.0-beta.17" + "typescript": "6.0.0-dev.20251119", + "vitest": "4.0.10" }, "jest": { "testEnvironment": "node", diff --git a/source/mapParallelAsync.js b/source/mapParallelAsync.js index 6bb72ab5..05d17d71 100644 --- a/source/mapParallelAsync.js +++ b/source/mapParallelAsync.js @@ -1,3 +1,13 @@ -export function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) +export function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = [] + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize) + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))) + result.push(...batchResult) + } + return result + } } diff --git a/source/mapParallelAsync.spec.js b/source/mapParallelAsync.spec.js index 02cd3134..7cc16644 100644 --- a/source/mapParallelAsync.spec.js +++ b/source/mapParallelAsync.spec.js @@ -23,3 +23,14 @@ test('pipeAsync', async () => { ) expect(result).toEqual([ 2,3,4 ]) }) + +test('with batchSize', async () => { + const fn = async (x, i) => { + await delay(100) + return `${x}:${i}` + } + const result = await mapParallelAsync(fn, 2)([1, 2, 3, 4, 5]) + expect(result).toEqual( + ['1:0', '2:1', '3:2', '4:3', '5:4'] + ) +}) diff --git a/source/mapPropObject-spec.ts b/source/mapPropObject-spec.ts index 32f93831..4e9988ec 100644 --- a/source/mapPropObject-spec.ts +++ b/source/mapPropObject-spec.ts @@ -1,19 +1,47 @@ -import { mapPropObject, pipe } from 'rambda' +import { map, mapPropObject, pipe } from 'rambda' describe('R.mapPropObject', () => { it('iterable with one arguments', () => { const result = pipe( { a: [1,2,3], b: 'foo' }, - mapPropObject(x => { + mapPropObject('a', x => { x // $ExpectType number return { a: x, flag: x > 2, } - }, 'a'), + }), ) result.a // $ExpectType { a: number; flag: boolean; }[] result.b // $ExpectType string }) + + it('iterable with two arguments', () => { + const result = pipe( + { a: [1,2,3], b: 'foo' }, + mapPropObject('a', (x, list) => { + x // $ExpectType number + list // $ExpectType number[] + return list.length + }), + ) + result.a // $ExpectType number[] + result.b // $ExpectType string + }) + + it('more complex example', () => { + const result = pipe( + [{a:[true, false, true], b: 'foo'}], + map( + mapPropObject( 'a',(a) => { + a // $ExpectType boolean + return {a, b: 2} + }) + ) + ) + + result[0].a[0].a // $ExpectType boolean + result[0].a[0].b // $ExpectType number + }) }) diff --git a/source/sortByDescending.spec.js b/source/sortByDescending.spec.js new file mode 100644 index 00000000..df831ec2 --- /dev/null +++ b/source/sortByDescending.spec.js @@ -0,0 +1,10 @@ +import { sortByDescending } from './sortByDescending.js' +import { path } from './path.js' + +const list = [{ a: { b: 3 } }, { a: { b: 1 } }, { a: { b: 2 } }] +const sorted = [{ a: { b: 3 } }, { a: { b: 2 } }, { a: { b: 1 } }] + +test('happy', () => { + expect(sortByDescending(path('a.b'))(list)).toEqual(sorted) +}) + diff --git a/source/ts-katas.ts b/source/ts-katas.ts index 7528763f..333fa26e 100644 --- a/source/ts-katas.ts +++ b/source/ts-katas.ts @@ -1,4 +1,10 @@ -import { type MergeTypes, type MergeTypesAlternative, pipe } from 'rambda' +import { map, type MergeTypes, type MergeTypesAlternative, pipe, splitEvery } from 'rambda' + +let a = pipe( + [[1,2,3],[4,5,6]], + map(splitEvery(2)) +) +a type DeepPick = K extends keyof T ? { [P in K]: T[P] } diff --git a/source/tsconfig.json b/source/tsconfig.json index 43d4dcf2..c442cb0a 100644 --- a/source/tsconfig.json +++ b/source/tsconfig.json @@ -1,7 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", - "ignoreDeprecations": "6.0", "lib": ["es2015", "dom"], "module": "commonjs", "noEmit": true, diff --git a/src/mapParallelAsync.js b/src/mapParallelAsync.js index 6bb72ab5..05d17d71 100644 --- a/src/mapParallelAsync.js +++ b/src/mapParallelAsync.js @@ -1,3 +1,13 @@ -export function mapParallelAsync(fn) { - return async list => Promise.all(list.map((x, i) => fn(x, i))) +export function mapParallelAsync(fn, batchSize){ + if(!batchSize) return async list => Promise.all(list.map(fn)) + + return async list => { + const result = [] + for(let i = 0; i < list.length; i += batchSize){ + const batch = list.slice(i, i + batchSize) + const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j))) + result.push(...batchResult) + } + return result + } } diff --git a/sugg.txt b/sugg.txt deleted file mode 100644 index 4264633e..00000000 --- a/sugg.txt +++ /dev/null @@ -1,24 +0,0 @@ -Suggested new methods for Rambda library: - - -15. `sortByMultiple` - Sort by multiple criteria: -```typescript -export function sortByMultiple( - criteria: Array<(a: T, b: T) => number> -): (list: T[]) => T[]; -``` - -These suggestions are based on: -1. Common use cases in TypeScript projects -2. Working well within `R.pipe` chains -3. Having clear, single-purpose functionality -4. Being type-safe -5. Following the library's focus on object manipulation and array operations -6. Complementing existing methods - -The suggestions avoid methods that: -1. Have confusing or ambiguous behavior -2. Don't work well in pipe chains -3. Have multiple ways to be used -4. Are better suited as part of application code -5. Have complex TypeScript definitions that would be hard to maintain \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index d8ac6b5c..313fd39b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,30 +2,30 @@ # yarn lockfile v1 -"@babel/helper-string-parser@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" - integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== +"@babel/helper-string-parser@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" + integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== -"@babel/helper-validator-identifier@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" - integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== +"@babel/helper-validator-identifier@^7.28.5": + version "7.28.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" + integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== -"@babel/parser@^7.25.4": - version "7.26.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.7.tgz#e114cd099e5f7d17b05368678da0fb9f69b3385c" - integrity sha512-kEvgGGgEjRUutvdVvZhbn/BxVt+5VSpwXz1j3WYXQbXDo8KzFOPNG2GQbdAiNq8g6wn1yKk7C/qrke03a84V+w== +"@babel/parser@^7.28.5": + version "7.28.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.5.tgz#0b0225ee90362f030efd644e8034c99468893b08" + integrity sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ== dependencies: - "@babel/types" "^7.26.7" + "@babel/types" "^7.28.5" -"@babel/types@^7.25.4", "@babel/types@^7.26.7": - version "7.26.7" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.7.tgz#5e2b89c0768e874d4d061961f3a5a153d71dc17a" - integrity sha512-t8kDRGrKXyp6+tjUh7hw2RLyclsW4TRoRvRHtSyAX9Bb5ldlFh+90YAYY6awRXrlB4G5G2izNeGySpATlFzmOg== +"@babel/types@^7.28.5": + version "7.28.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.5.tgz#10fc405f60897c35f07e85493c932c7b5ca0592b" + integrity sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA== dependencies: - "@babel/helper-string-parser" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.28.5" "@bcoe/v8-coverage@^1.0.2": version "1.0.2" @@ -345,111 +345,226 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.4.tgz#59e7478d310f7e6a7c72453978f562483828112f" integrity sha512-BTm2qKNnWIQ5auf4deoetINJm2JzvihvGb9R6K/ETwKLql/Bb3Eg2H1FBp1gUb4YGbydMA3jcmQTR73q7J+GAA== +"@rollup/rollup-android-arm-eabi@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz#7e478b66180c5330429dd161bf84dad66b59c8eb" + integrity sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w== + "@rollup/rollup-android-arm64@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.4.tgz#a825192a0b1b2f27a5c950c439e7e37a33c5d056" integrity sha512-P9LDQiC5vpgGFgz7GSM6dKPCiqR3XYN1WwJKA4/BUVDjHpYsf3iBEmVz62uyq20NGYbiGPR5cNHI7T1HqxNs2w== +"@rollup/rollup-android-arm64@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz#2b025510c53a5e3962d3edade91fba9368c9d71c" + integrity sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w== + "@rollup/rollup-darwin-arm64@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.4.tgz#4ee37078bccd725ae3c5f30ef92efc8e1bf886f3" integrity sha512-QRWSW+bVccAvZF6cbNZBJwAehmvG9NwfWHwMy4GbWi/BQIA/laTIktebT2ipVjNncqE6GLPxOok5hsECgAxGZg== +"@rollup/rollup-darwin-arm64@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz#3577c38af68ccf34c03e84f476bfd526abca10a0" + integrity sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA== + "@rollup/rollup-darwin-x64@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.4.tgz#43cc08bd05bf9f388f125e7210a544e62d368d90" integrity sha512-hZgP05pResAkRJxL1b+7yxCnXPGsXU0fG9Yfd6dUaoGk+FhdPKCJ5L1Sumyxn8kvw8Qi5PvQ8ulenUbRjzeCTw== +"@rollup/rollup-darwin-x64@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz#2bf5f2520a1f3b551723d274b9669ba5b75ed69c" + integrity sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ== + "@rollup/rollup-freebsd-arm64@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.4.tgz#bc8e640e28abe52450baf3fc80d9b26d9bb6587d" integrity sha512-xmc30VshuBNUd58Xk4TKAEcRZHaXlV+tCxIXELiE9sQuK3kG8ZFgSPi57UBJt8/ogfhAF5Oz4ZSUBN77weM+mQ== +"@rollup/rollup-freebsd-arm64@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz#4bb9cc80252564c158efc0710153c71633f1927c" + integrity sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w== + "@rollup/rollup-freebsd-x64@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.4.tgz#e981a22e057cc8c65bb523019d344d3a66b15bbc" integrity sha512-WdSLpZFjOEqNZGmHflxyifolwAiZmDQzuOzIq9L27ButpCVpD7KzTRtEG1I0wMPFyiyUdOO+4t8GvrnBLQSwpw== +"@rollup/rollup-freebsd-x64@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz#2301289094d49415a380cf942219ae9d8b127440" + integrity sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q== + "@rollup/rollup-linux-arm-gnueabihf@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.4.tgz#4036b68904f392a20f3499d63b33e055b67eb274" integrity sha512-xRiOu9Of1FZ4SxVbB0iEDXc4ddIcjCv2aj03dmW8UrZIW7aIQ9jVJdLBIhxBI+MaTnGAKyvMwPwQnoOEvP7FgQ== +"@rollup/rollup-linux-arm-gnueabihf@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz#1d03d776f2065e09fc141df7d143476e94acca88" + integrity sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw== + "@rollup/rollup-linux-arm-musleabihf@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.4.tgz#d3b1b9589606e0ff916801c855b1ace9e733427a" integrity sha512-FbhM2p9TJAmEIEhIgzR4soUcsW49e9veAQCziwbR+XWB2zqJ12b4i/+hel9yLiD8pLncDH4fKIPIbt5238341Q== +"@rollup/rollup-linux-arm-musleabihf@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz#8623de0e040b2fd52a541c602688228f51f96701" + integrity sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg== + "@rollup/rollup-linux-arm64-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.4.tgz#cbf0943c477e3b96340136dd3448eaf144378cf2" integrity sha512-4n4gVwhPHR9q/g8lKCyz0yuaD0MvDf7dV4f9tHt0C73Mp8h38UCtSCSE6R9iBlTbXlmA8CjpsZoujhszefqueg== +"@rollup/rollup-linux-arm64-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz#ce2d1999bc166277935dde0301cde3dd0417fb6e" + integrity sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w== + "@rollup/rollup-linux-arm64-musl@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.4.tgz#837f5a428020d5dce1c3b4cc049876075402cf78" integrity sha512-u0n17nGA0nvi/11gcZKsjkLj1QIpAuPFQbR48Subo7SmZJnGxDpspyw2kbpuoQnyK+9pwf3pAoEXerJs/8Mi9g== +"@rollup/rollup-linux-arm64-musl@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz#88c2523778444da952651a2219026416564a4899" + integrity sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A== + "@rollup/rollup-linux-loong64-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.4.tgz#532c214ababb32ab4bc21b4054278b9a8979e516" integrity sha512-0G2c2lpYtbTuXo8KEJkDkClE/+/2AFPdPAbmaHoE870foRFs4pBrDehilMcrSScrN/fB/1HTaWO4bqw+ewBzMQ== +"@rollup/rollup-linux-loong64-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz#578ca2220a200ac4226c536c10c8cc6e4f276714" + integrity sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g== + "@rollup/rollup-linux-ppc64-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.4.tgz#93900163b61b49cee666d10ee38257a8b1dd161a" integrity sha512-teSACug1GyZHmPDv14VNbvZFX779UqWTsd7KtTM9JIZRDI5NUwYSIS30kzI8m06gOPB//jtpqlhmraQ68b5X2g== +"@rollup/rollup-linux-ppc64-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz#aa338d3effd4168a20a5023834a74ba2c3081293" + integrity sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw== + "@rollup/rollup-linux-riscv64-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.4.tgz#f0ffdcc7066ca04bc972370c74289f35c7a7dc42" integrity sha512-/MOEW3aHjjs1p4Pw1Xk4+3egRevx8Ji9N6HUIA1Ifh8Q+cg9dremvFCUbOX2Zebz80BwJIgCBUemjqhU5XI5Eg== +"@rollup/rollup-linux-riscv64-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz#16ba582f9f6cff58119aa242782209b1557a1508" + integrity sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g== + "@rollup/rollup-linux-riscv64-musl@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.4.tgz#361695c39dbe96773509745d77a870a32a9f8e48" integrity sha512-1HHmsRyh845QDpEWzOFtMCph5Ts+9+yllCrREuBR/vg2RogAQGGBRC8lDPrPOMnrdOJ+mt1WLMOC2Kao/UwcvA== +"@rollup/rollup-linux-riscv64-musl@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz#e404a77ebd6378483888b8064c703adb011340ab" + integrity sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A== + "@rollup/rollup-linux-s390x-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.4.tgz#09fc6cc2e266a2324e366486ae5d1bca48c43a6a" integrity sha512-seoeZp4L/6D1MUyjWkOMRU6/iLmCU2EjbMTyAG4oIOs1/I82Y5lTeaxW0KBfkUdHAWN7j25bpkt0rjnOgAcQcA== +"@rollup/rollup-linux-s390x-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz#92ad52d306227c56bec43d96ad2164495437ffe6" + integrity sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg== + "@rollup/rollup-linux-x64-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.4.tgz#aa9d5b307c08f05d3454225bb0a2b4cc87eeb2e1" integrity sha512-Wi6AXf0k0L7E2gteNsNHUs7UMwCIhsCTs6+tqQ5GPwVRWMaflqGec4Sd8n6+FNFDw9vGcReqk2KzBDhCa1DLYg== +"@rollup/rollup-linux-x64-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz#fd0dea3bb9aa07e7083579f25e1c2285a46cb9fa" + integrity sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w== + "@rollup/rollup-linux-x64-musl@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.4.tgz#26949e5b4645502a61daba2f7a8416bd17cb5382" integrity sha512-dtBZYjDmCQ9hW+WgEkaffvRRCKm767wWhxsFW3Lw86VXz/uJRuD438/XvbZT//B96Vs8oTA8Q4A0AfHbrxP9zw== +"@rollup/rollup-linux-x64-musl@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz#37a3efb09f18d555f8afc490e1f0444885de8951" + integrity sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q== + "@rollup/rollup-openharmony-arm64@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.4.tgz#ef493c072f9dac7e0edb6c72d63366846b6ffcd9" integrity sha512-1ox+GqgRWqaB1RnyZXL8PD6E5f7YyRUJYnCqKpNzxzP0TkaUh112NDrR9Tt+C8rJ4x5G9Mk8PQR3o7Ku2RKqKA== +"@rollup/rollup-openharmony-arm64@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz#c489bec9f4f8320d42c9b324cca220c90091c1f7" + integrity sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw== + "@rollup/rollup-win32-arm64-msvc@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.4.tgz#56e1aaa6a630d2202ee7ec0adddd05cf384ffd44" integrity sha512-8GKr640PdFNXwzIE0IrkMWUNUomILLkfeHjXBi/nUvFlpZP+FA8BKGKpacjW6OUUHaNI6sUURxR2U2g78FOHWQ== +"@rollup/rollup-win32-arm64-msvc@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz#152832b5f79dc22d1606fac3db946283601b7080" + integrity sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw== + "@rollup/rollup-win32-ia32-msvc@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.4.tgz#0a44bbf933a9651c7da2b8569fa448dec0de7480" integrity sha512-AIy/jdJ7WtJ/F6EcfOb2GjR9UweO0n43jNObQMb6oGxkYTfLcnN7vYYpG+CN3lLxrQkzWnMOoNSHTW54pgbVxw== +"@rollup/rollup-win32-ia32-msvc@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz#54d91b2bb3bf3e9f30d32b72065a4e52b3a172a5" + integrity sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA== + "@rollup/rollup-win32-x64-gnu@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.4.tgz#730e12f0b60b234a7c02d5d3179ca3ec7972033d" integrity sha512-UF9KfsH9yEam0UjTwAgdK0anlQ7c8/pWPU2yVjyWcF1I1thABt6WXE47cI71pGiZ8wGvxohBoLnxM04L/wj8mQ== +"@rollup/rollup-win32-x64-gnu@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz#df9df03e61a003873efec8decd2034e7f135c71e" + integrity sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg== + "@rollup/rollup-win32-x64-msvc@4.52.4": version "4.52.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.4.tgz#5b2dd648a960b8fa00d76f2cc4eea2f03daa80f4" integrity sha512-bf9PtUa0u8IXDVxzRToFQKsNCRz9qLYfR/MpECxl4mRoWYjAeFjgxj1XdZr2M/GNVpT05p+LgQOHopYDlUu6/w== +"@rollup/rollup-win32-x64-msvc@4.53.3": + version "4.53.3" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz#38ae84f4c04226c1d56a3b17296ef1e0460ecdfe" + integrity sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ== + +"@standard-schema/spec@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.0.0.tgz#f193b73dc316c4170f2e82a881da0f550d551b9c" + integrity sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA== + "@types/chai@^5.2.2": version "5.2.2" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-5.2.2.tgz#6f14cea18180ffc4416bc0fd12be05fdd73bdd6b" @@ -482,12 +597,12 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.10.tgz#91f62905e8d23cbd66225312f239454a23bebfa0" integrity sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q== -"@types/node@24.7.0": - version "24.7.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.7.0.tgz#a34c9f0d3401db396782e440317dd5d8373c286f" - integrity sha512-IbKooQVqUBrlzWTi79E8Fw78l8k1RNtlDDNWsFZs7XonuQSJ8oNYfEeclhprUldXISRMLzBpILuKgPlIxm+/Yw== +"@types/node@24.10.1": + version "24.10.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.10.1.tgz#91e92182c93db8bd6224fca031e2370cef9a8f01" + integrity sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ== dependencies: - undici-types "~7.14.0" + undici-types "~7.16.0" "@types/node@^14.14.35": version "14.18.63" @@ -598,78 +713,79 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@vitest/coverage-v8@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-4.0.0-beta.17.tgz#0e01e43b988a833d7595f16af54118598d08b109" - integrity sha512-QetR5ju+OeIK6EyOKz/Z3txW9oFTn262VkCngrfXMNwPo6FWTHzMPIl98V/qxIzsAlrSVG85XuVJcC3XdC7LwA== +"@vitest/coverage-v8@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-4.0.10.tgz#834f2d411522a6e8772bfb7ef2c9e79c648a2b4d" + integrity sha512-g+brmtoKa/sAeIohNJnnWhnHtU6GuqqVOSQ4SxDIPcgZWZyhJs5RmF5LpqXs8Kq64lANP+vnbn5JLzhLj/G56g== dependencies: "@bcoe/v8-coverage" "^1.0.2" - "@vitest/utils" "4.0.0-beta.17" - ast-v8-to-istanbul "^0.3.5" + "@vitest/utils" "4.0.10" + ast-v8-to-istanbul "^0.3.8" debug "^4.4.3" istanbul-lib-coverage "^3.2.2" istanbul-lib-report "^3.0.1" istanbul-lib-source-maps "^5.0.6" istanbul-reports "^3.2.0" - magicast "^0.3.5" - std-env "^3.9.0" + magicast "^0.5.1" + std-env "^3.10.0" tinyrainbow "^3.0.3" -"@vitest/expect@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-4.0.0-beta.17.tgz#4e9a1a1ae8800adee9f9d36f41affb13da1ce532" - integrity sha512-guY0R9wPiwecV5+ptTVC4qGiOB0Ip5NVn9e8T1Wrf4HubG61MDL+iI1dPpkxJBm1U4yXev6gBkT/vrVtR/5q0w== +"@vitest/expect@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-4.0.10.tgz#cb97fc35d0938f2f7c62694812131fbb986fa5ce" + integrity sha512-3QkTX/lK39FBNwARCQRSQr0TP9+ywSdxSX+LgbJ2M1WmveXP72anTbnp2yl5fH+dU6SUmBzNMrDHs80G8G2DZg== dependencies: + "@standard-schema/spec" "^1.0.0" "@types/chai" "^5.2.2" - "@vitest/spy" "4.0.0-beta.17" - "@vitest/utils" "4.0.0-beta.17" - chai "^6.0.1" + "@vitest/spy" "4.0.10" + "@vitest/utils" "4.0.10" + chai "^6.2.1" tinyrainbow "^3.0.3" -"@vitest/mocker@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-4.0.0-beta.17.tgz#9bfce78f6ebbfe93d8458c5ed4ec509db369f45a" - integrity sha512-m56dc63UL10BiFHZ++XdFv58YEHAjRvgL4Mbb+Qlrkk5ul2cs7Q6LzuXDUE2TshVRnPWzwWXT3N+aAygrplIvw== +"@vitest/mocker@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-4.0.10.tgz#66ea2d6f563b26f72fd3e27ee5cbb01a70640584" + integrity sha512-e2OfdexYkjkg8Hh3L9NVEfbwGXq5IZbDovkf30qW2tOh7Rh9sVtmSr2ztEXOFbymNxS4qjzLXUQIvATvN4B+lg== dependencies: - "@vitest/spy" "4.0.0-beta.17" + "@vitest/spy" "4.0.10" estree-walker "^3.0.3" - magic-string "^0.30.19" + magic-string "^0.30.21" -"@vitest/pretty-format@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-4.0.0-beta.17.tgz#92928781c5dffd5367308f6ce4168ad93c341abc" - integrity sha512-CSlfXqUgCOem5bawWaWHyEapCiJbLkkpbQJMXbVZMjPXmS25rmTTvLR4R8pGW53GV0b6c1L4Bt2DoZiZtx1elA== +"@vitest/pretty-format@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-4.0.10.tgz#1ae410f4a98b60921879828143342f59a5edfcf9" + integrity sha512-99EQbpa/zuDnvVjthwz5bH9o8iPefoQZ63WV8+bsRJZNw3qQSvSltfut8yu1Jc9mqOYi7pEbsKxYTi/rjaq6PA== dependencies: tinyrainbow "^3.0.3" -"@vitest/runner@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-4.0.0-beta.17.tgz#1f3ac12fef6effd61697370ddd06977307a15d47" - integrity sha512-jhMbh3NPjZNFQJA3OtCFP5taNmPkyujsXd6T7NK7/0lwgb8CEGqgNfFUe9vZU9i1+HcTz2vRLXKETgyg42fulg== +"@vitest/runner@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-4.0.10.tgz#c91c4c6e1bad92d2a07ca6da287ff076a0a6589f" + integrity sha512-EXU2iSkKvNwtlL8L8doCpkyclw0mc/t4t9SeOnfOFPyqLmQwuceMPA4zJBa6jw0MKsZYbw7kAn+gl7HxrlB8UQ== dependencies: - "@vitest/utils" "4.0.0-beta.17" + "@vitest/utils" "4.0.10" pathe "^2.0.3" -"@vitest/snapshot@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-4.0.0-beta.17.tgz#fee457fbd59d8dde9556e184ae90207bd0064487" - integrity sha512-Ccq1hYME9kgxWiqlsTyVjkpRTAaGOVMOKJryYv1ybePg0TJFdPts32WYW74J8YKg53ZcDOjWhv3QkTTl7p7Ntw== +"@vitest/snapshot@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-4.0.10.tgz#e3d4f188105d6197e385c85c2c06a37be9732c6d" + integrity sha512-2N4X2ZZl7kZw0qeGdQ41H0KND96L3qX1RgwuCfy6oUsF2ISGD/HpSbmms+CkIOsQmg2kulwfhJ4CI0asnZlvkg== dependencies: - "@vitest/pretty-format" "4.0.0-beta.17" - magic-string "^0.30.19" + "@vitest/pretty-format" "4.0.10" + magic-string "^0.30.21" pathe "^2.0.3" -"@vitest/spy@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-4.0.0-beta.17.tgz#199db3930db8096896427e4c2722ec376f225b9f" - integrity sha512-c6sIXHQSMx1yDBbDF1vHDaJ+2KQySOExYuQhFMj3lG1woTVdRmX1omtPsLypsa7uVwVLc466DtLVvgAsSQIi2g== +"@vitest/spy@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-4.0.10.tgz#e40f246bd0e8b5321766afd97230cdac21783157" + integrity sha512-AsY6sVS8OLb96GV5RoG8B6I35GAbNrC49AO+jNRF9YVGb/g9t+hzNm1H6kD0NDp8tt7VJLs6hb7YMkDXqu03iw== -"@vitest/utils@4.0.0-beta.17": - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-4.0.0-beta.17.tgz#357fd40911dc66f584aaefeab288695463ac1e0d" - integrity sha512-PdhF3Kk1QFQ0H6iQzILGXCNDuhFgdxJKGJwzpPr/Hk7KWKiymj2w/7gusB95Ckh0t/kJPW+O99afLzoRPGsrFw== +"@vitest/utils@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-4.0.10.tgz#04e5cb5d5237160477fd364d2b58744c0e5695be" + integrity sha512-kOuqWnEwZNtQxMKg3WmPK1vmhZu9WcoX69iwWjVz+jvKTsF1emzsv3eoPcDr6ykA3qP2bsCQE7CwqfNtAVzsmg== dependencies: - "@vitest/pretty-format" "4.0.0-beta.17" + "@vitest/pretty-format" "4.0.10" tinyrainbow "^3.0.3" acorn-jsx@^5.3.2: @@ -763,10 +879,10 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== -ast-v8-to-istanbul@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/ast-v8-to-istanbul/-/ast-v8-to-istanbul-0.3.6.tgz#5ef80900b52fdf58a3d9cdb8e692f70d9460aebf" - integrity sha512-9tx1z/7OF/a8EdYL3FKoBhxLf3h3D8fXvuSj0HknsVeli2HE40qbNZxyFhMtnydaRiamwFu9zhb+BsJ5tVPehQ== +ast-v8-to-istanbul@^0.3.8: + version "0.3.8" + resolved "https://registry.yarnpkg.com/ast-v8-to-istanbul/-/ast-v8-to-istanbul-0.3.8.tgz#0a3faf070dc780dcebdf9d48af78dbd174a497a9" + integrity sha512-szgSZqUxI5T8mLKvS7WTjF9is+MVbOeLADU73IseOcrqhxr/VAvy6wfoVE39KnKzA7JRhjF5eUagNlHwvZPlKQ== dependencies: "@jridgewell/trace-mapping" "^0.3.31" estree-walker "^3.0.3" @@ -894,10 +1010,10 @@ cfonts@3.3.0: supports-color "^8" window-size "^1" -chai@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/chai/-/chai-6.0.1.tgz#88c2b4682fb56050647e222d2cf9d6772f2607b3" - integrity sha512-/JOoU2//6p5vCXh00FpNgtlw0LjvhGttaWc+y7wpW9yjBm3ys0dI8tSKZxIOgNruz5J0RleccatSIC3uxEZP0g== +chai@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/chai/-/chai-6.2.1.tgz#d1e64bc42433fbee6175ad5346799682060b5b6a" + integrity sha512-p4Z49OGG5W/WBCPSS/dH3jQ73kD6tiMmUM+bckNK6Jr5JHMG3k9bg/BvKR8lKmtVBKmOiuVaV2ws8s9oSbwysg== chalk@4.0.0: version "4.0.0" @@ -2074,21 +2190,21 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -magic-string@^0.30.19: - version "0.30.19" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.19.tgz#cebe9f104e565602e5d2098c5f2e79a77cc86da9" - integrity sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw== +magic-string@^0.30.21: + version "0.30.21" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.21.tgz#56763ec09a0fa8091df27879fd94d19078c00d91" + integrity sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ== dependencies: "@jridgewell/sourcemap-codec" "^1.5.5" -magicast@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.3.5.tgz#8301c3c7d66704a0771eb1bad74274f0ec036739" - integrity sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ== +magicast@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.5.1.tgz#518959aea78851cd35d4bb0da92f780db3f606d3" + integrity sha512-xrHS24IxaLrvuo613F719wvOIv9xPHFWQHuvGUBmPnCA/3MQxKI3b+r7n1jAoDHmsbC5bRhTZYR77invLAxVnw== dependencies: - "@babel/parser" "^7.25.4" - "@babel/types" "^7.25.4" - source-map-js "^1.2.0" + "@babel/parser" "^7.28.5" + "@babel/types" "^7.28.5" + source-map-js "^1.2.1" make-dir@^4.0.0: version "4.0.0" @@ -2432,10 +2548,10 @@ rambdax@7.0.1: resolved "https://registry.yarnpkg.com/rambdax/-/rambdax-7.0.1.tgz#6a1b3184abcf4cf6df5dffc27fc0d71100aa21ec" integrity sha512-Xrrp45dg1PLt40LMcjfNyVDcPBndzpR2t+AXGAcc9iqU9lD9bnk/b1B+n4W5tFXoSKDmZmgckcA8ajgVzbtxGA== -ramda@0.31.3: - version "0.31.3" - resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.31.3.tgz#0f54199ec99a7bd6702277d28d6bf7f93b916bb9" - integrity sha512-xKADKRNnqmDdX59PPKLm3gGmk1ZgNnj3k7DryqWwkamp4TJ6B36DdpyKEQ0EoEYmH2R62bV4Q+S0ym2z8N2f3Q== +ramda@0.32.0: + version "0.32.0" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.32.0.tgz#b2116807b59b6b177af7a2ad19b14a3653570e96" + integrity sha512-GQWAHhxhxWBWA8oIBr1XahFVjQ9Fic6MK9ikijfd4TZHfE2+urfk+irVlR5VOn48uwMgM+loRRBJd6Yjsbc0zQ== readable-stream@^2.0.6: version "2.3.8" @@ -2540,7 +2656,38 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" -rollup@4.52.4, rollup@^4.43.0: +rollup@4.53.3: + version "4.53.3" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.53.3.tgz#dbc8cd8743b38710019fb8297e8d7a76e3faa406" + integrity sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA== + dependencies: + "@types/estree" "1.0.8" + optionalDependencies: + "@rollup/rollup-android-arm-eabi" "4.53.3" + "@rollup/rollup-android-arm64" "4.53.3" + "@rollup/rollup-darwin-arm64" "4.53.3" + "@rollup/rollup-darwin-x64" "4.53.3" + "@rollup/rollup-freebsd-arm64" "4.53.3" + "@rollup/rollup-freebsd-x64" "4.53.3" + "@rollup/rollup-linux-arm-gnueabihf" "4.53.3" + "@rollup/rollup-linux-arm-musleabihf" "4.53.3" + "@rollup/rollup-linux-arm64-gnu" "4.53.3" + "@rollup/rollup-linux-arm64-musl" "4.53.3" + "@rollup/rollup-linux-loong64-gnu" "4.53.3" + "@rollup/rollup-linux-ppc64-gnu" "4.53.3" + "@rollup/rollup-linux-riscv64-gnu" "4.53.3" + "@rollup/rollup-linux-riscv64-musl" "4.53.3" + "@rollup/rollup-linux-s390x-gnu" "4.53.3" + "@rollup/rollup-linux-x64-gnu" "4.53.3" + "@rollup/rollup-linux-x64-musl" "4.53.3" + "@rollup/rollup-openharmony-arm64" "4.53.3" + "@rollup/rollup-win32-arm64-msvc" "4.53.3" + "@rollup/rollup-win32-ia32-msvc" "4.53.3" + "@rollup/rollup-win32-x64-gnu" "4.53.3" + "@rollup/rollup-win32-x64-msvc" "4.53.3" + fsevents "~2.3.2" + +rollup@^4.43.0: version "4.52.4" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.52.4.tgz#71e64cce96a865fcbaa6bb62c6e82807f4e378a1" integrity sha512-CLEVl+MnPAiKh5pl4dEWSyMTpuflgNQiLGhMv8ezD5W/qP8AKvmYpCOKRRNOh7oRKnauBZ4SyeYkMS+1VSyKwQ== @@ -2657,7 +2804,7 @@ slide@^1.1.6: resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" integrity sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw== -source-map-js@^1.2.0, source-map-js@^1.2.1: +source-map-js@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== @@ -2720,10 +2867,10 @@ stackback@0.0.2: resolved "https://registry.yarnpkg.com/stackback/-/stackback-0.0.2.tgz#1ac8a0d9483848d1695e418b6d031a3c3ce68e3b" integrity sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw== -std-env@^3.9.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.9.0.tgz#1a6f7243b339dca4c9fd55e1c7504c77ef23e8f1" - integrity sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw== +std-env@^3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.10.0.tgz#d810b27e3a073047b2b5e40034881f5ea6f9c83b" + integrity sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg== string-fn@3.3.2: version "3.3.2" @@ -2887,11 +3034,6 @@ tinygradient@^1.1.5: "@types/tinycolor2" "^1.4.0" tinycolor2 "^1.0.0" -tinypool@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-2.0.0.tgz#7eaea50341e1026cecb75e04d4e6ea6ede68b7ca" - integrity sha512-/RX9RzeH2xU5ADE7n2Ykvmi9ED3FBGPAjw9u3zucrNNaEBIO0HPSYgL0NT7+3p147ojeSdaVu08F6hjpv31HJg== - tinyrainbow@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/tinyrainbow/-/tinyrainbow-3.0.3.tgz#984a5b1c1b25854a9b6bccbe77964d0593d1ea42" @@ -3001,15 +3143,15 @@ types-ramda@0.31.0: dependencies: ts-toolbelt "^9.6.0" -typescript@6.0.0-dev.20251006: - version "6.0.0-dev.20251006" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.0-dev.20251006.tgz#f8c6b3dc5f7df5fc8fdaefa691f0c6e73ebe4428" - integrity sha512-DHt+o3xZV+a3cambN7XN1l0RH9PP3bYhUn2pwWyHqSA7j5HSR4MjTEf2hFGpty3/IZj6zHztEBtq4B6bGRdJgg== +typescript@6.0.0-dev.20251119: + version "6.0.0-dev.20251119" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.0-dev.20251119.tgz#0b89469276f58969cfee6285de2dddac9431aa03" + integrity sha512-bP8dUqiG7IzMxPqKQRc7MSdmKvt/7eUeHgRp0Cbv7ta5x4Q0sV4OSzB/6PrTbLdpXpKVD+Cw4vobCcBPNeejUg== -undici-types@~7.14.0: - version "7.14.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.14.0.tgz#4c037b32ca4d7d62fae042174604341588bc0840" - integrity sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA== +undici-types@~7.16.0: + version "7.16.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" + integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== universalify@^0.1.0: version "0.1.2" @@ -3076,29 +3218,28 @@ verror@1.10.0: optionalDependencies: fsevents "~2.3.3" -vitest@4.0.0-beta.17: - version "4.0.0-beta.17" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-4.0.0-beta.17.tgz#ab9a1105256d52d5d2b9c0439075d66502a8de9a" - integrity sha512-R2vM2ErERS4hcmrZ0vrGhy/v9HEkCRnUXHJLhuvnQfO8uWspjuMNxIej1Ru/pBvR5pDfN2mqb1679Lk4yyJ7NA== - dependencies: - "@vitest/expect" "4.0.0-beta.17" - "@vitest/mocker" "4.0.0-beta.17" - "@vitest/pretty-format" "4.0.0-beta.17" - "@vitest/runner" "4.0.0-beta.17" - "@vitest/snapshot" "4.0.0-beta.17" - "@vitest/spy" "4.0.0-beta.17" - "@vitest/utils" "4.0.0-beta.17" +vitest@4.0.10: + version "4.0.10" + resolved "https://registry.yarnpkg.com/vitest/-/vitest-4.0.10.tgz#587e3d5594444c5ae2e02310f1b1df891b04a0b7" + integrity sha512-2Fqty3MM9CDwOVet/jaQalYlbcjATZwPYGcqpiYQqgQ/dLC7GuHdISKgTYIVF/kaishKxLzleKWWfbSDklyIKg== + dependencies: + "@vitest/expect" "4.0.10" + "@vitest/mocker" "4.0.10" + "@vitest/pretty-format" "4.0.10" + "@vitest/runner" "4.0.10" + "@vitest/snapshot" "4.0.10" + "@vitest/spy" "4.0.10" + "@vitest/utils" "4.0.10" debug "^4.4.3" es-module-lexer "^1.7.0" expect-type "^1.2.2" - magic-string "^0.30.19" + magic-string "^0.30.21" pathe "^2.0.3" picomatch "^4.0.3" - std-env "^3.9.0" + std-env "^3.10.0" tinybench "^2.9.0" tinyexec "^0.3.2" tinyglobby "^0.2.15" - tinypool "^2.0.0" tinyrainbow "^3.0.3" vite "^6.0.0 || ^7.0.0" why-is-node-running "^2.3.0"