@soundworks/core 5.0.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -471,6 +471,30 @@ class SharedStateCollection {
|
|
|
471
471
|
return this.#states.find(func);
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Execute a user-supplied "reducer" callback function on each element of the collection,
|
|
476
|
+
* in order, passing in the return value from the calculation on the preceding element.
|
|
477
|
+
* The final result of running the reducer across all elements of the array is a single value.
|
|
478
|
+
*
|
|
479
|
+
* @template T
|
|
480
|
+
* @param {Function} func - A function to execute for each element in the array.
|
|
481
|
+
* Its return value becomes the value of the accumulator parameter on the next
|
|
482
|
+
* invocation of callbackFn. For the last invocation, the return value becomes
|
|
483
|
+
* the return value of reduce(). The function is called with the following arguments:
|
|
484
|
+
* @param {T} initialValue - A value to which accumulator is initialized the first
|
|
485
|
+
* time the callback is called. If initialValue is specified, callbackFn starts
|
|
486
|
+
* executing with the first value in the array as currentValue.
|
|
487
|
+
* @return {T}
|
|
488
|
+
*/
|
|
489
|
+
reduce(func, initialValue) {
|
|
490
|
+
// compared to the native Array.reduce method, initial Value is mandatory
|
|
491
|
+
if (arguments.length < 0) {
|
|
492
|
+
throw new Error(`Cannot execute 'reduce' on 'SharedStateCollection: argument 2 is not defined`);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return this.#states.reduce(func, initialValue);
|
|
496
|
+
}
|
|
497
|
+
|
|
474
498
|
/**
|
|
475
499
|
* Iterable API, e.g. for use in `for .. of` loops
|
|
476
500
|
*/
|
package/src/common/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// [WARNING] This file is generated, do not edit
|
|
2
|
-
export default '5.0
|
|
2
|
+
export default '5.1.0';
|
|
@@ -296,6 +296,22 @@ declare class SharedStateCollection {
|
|
|
296
296
|
* @return {}
|
|
297
297
|
*/
|
|
298
298
|
find(func: Function): any;
|
|
299
|
+
/**
|
|
300
|
+
* Execute a user-supplied "reducer" callback function on each element of the collection,
|
|
301
|
+
* in order, passing in the return value from the calculation on the preceding element.
|
|
302
|
+
* The final result of running the reducer across all elements of the array is a single value.
|
|
303
|
+
*
|
|
304
|
+
* @template T
|
|
305
|
+
* @param {Function} func - A function to execute for each element in the array.
|
|
306
|
+
* Its return value becomes the value of the accumulator parameter on the next
|
|
307
|
+
* invocation of callbackFn. For the last invocation, the return value becomes
|
|
308
|
+
* the return value of reduce(). The function is called with the following arguments:
|
|
309
|
+
* @param {T} initialValue - A value to which accumulator is initialized the first
|
|
310
|
+
* time the callback is called. If initialValue is specified, callbackFn starts
|
|
311
|
+
* executing with the first value in the array as currentValue.
|
|
312
|
+
* @return {T}
|
|
313
|
+
*/
|
|
314
|
+
reduce<T>(func: Function, initialValue: T, ...args: any[]): T;
|
|
299
315
|
/** @private */
|
|
300
316
|
private [kSharedStateCollectionInit];
|
|
301
317
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "5.0
|
|
1
|
+
declare const _default: "5.1.0";
|
|
2
2
|
export default _default;
|