Add settings page for managing forecasting API key and URL via UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cae411eae7
commit
1c411e402e
19809 changed files with 1962608 additions and 97 deletions
54
frontend/node_modules/es-toolkit/dist/compat/array/reduce.mjs
generated
vendored
Normal file
54
frontend/node_modules/es-toolkit/dist/compat/array/reduce.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import { identity } from "../../function/identity.mjs";
|
||||
import { range } from "../../math/range.mjs";
|
||||
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
||||
//#region src/compat/array/reduce.ts
|
||||
/**
|
||||
* Reduces a collection to a single value using an iteratee function.
|
||||
*
|
||||
* @param collection - The collection to iterate over.
|
||||
* @param iteratee - The function invoked per iteration or the key to reduce over.
|
||||
* @param initialValue - The initial value.
|
||||
* @returns Returns the accumulated value.
|
||||
*
|
||||
* @example
|
||||
* // Using a reducer function
|
||||
* const array = [1, 2, 3];
|
||||
* reduce(array, (acc, value) => acc + value, 0); // => 6
|
||||
*
|
||||
* @example
|
||||
* // Using a reducer function with initialValue
|
||||
* const array = [1, 2, 3];
|
||||
* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false
|
||||
*
|
||||
* @example
|
||||
* // Using an object as the collection
|
||||
* const obj = { a: 1, b: 2, c: 3 };
|
||||
* reduce(obj, (acc, value) => acc + value, 0); // => 6
|
||||
*/
|
||||
function reduce(collection, iteratee = identity, accumulator) {
|
||||
const hasAccumulator = arguments.length >= 3;
|
||||
if (!collection) return accumulator;
|
||||
let keys;
|
||||
let startIndex = 0;
|
||||
if (isArrayLike(collection)) {
|
||||
keys = range(0, collection.length);
|
||||
if (!hasAccumulator && collection.length > 0) {
|
||||
accumulator = collection[0];
|
||||
startIndex += 1;
|
||||
}
|
||||
} else {
|
||||
keys = Object.keys(collection);
|
||||
if (!hasAccumulator && keys.length > 0) {
|
||||
accumulator = collection[keys[0]];
|
||||
startIndex += 1;
|
||||
}
|
||||
}
|
||||
for (let i = startIndex; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const value = collection[key];
|
||||
accumulator = iteratee(accumulator, value, key, collection);
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
//#endregion
|
||||
export { reduce };
|
||||
Loading…
Add table
Add a link
Reference in a new issue