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
33
frontend/node_modules/es-toolkit/dist/map/findValue.mjs
generated
vendored
Normal file
33
frontend/node_modules/es-toolkit/dist/map/findValue.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
//#region src/map/findValue.ts
|
||||
/**
|
||||
* Finds the first value in a Map for which the predicate function returns true.
|
||||
*
|
||||
* This function iterates through the entries of the Map and returns the value of the first
|
||||
* entry for which the predicate function returns true. If no entry satisfies the predicate,
|
||||
* it returns undefined.
|
||||
*
|
||||
* @template K - The type of keys in the Map.
|
||||
* @template V - The type of values in the Map.
|
||||
* @param map - The Map to search.
|
||||
* @param doesMatch - A predicate function that tests each entry.
|
||||
* @returns The value of the first entry that satisfies the predicate, or undefined if none found.
|
||||
*
|
||||
* @example
|
||||
* const map = new Map([
|
||||
* ['apple', { color: 'red', quantity: 10 }],
|
||||
* ['banana', { color: 'yellow', quantity: 5 }],
|
||||
* ['grape', { color: 'purple', quantity: 15 }]
|
||||
* ]);
|
||||
* const result = findValue(map, (value) => value.quantity > 10);
|
||||
* // result will be: { color: 'purple', quantity: 15 }
|
||||
*/
|
||||
function findValue(map, doesMatch) {
|
||||
let result = void 0;
|
||||
for (const [key, value] of map) if (doesMatch(value, key, map)) {
|
||||
result = value;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//#endregion
|
||||
export { findValue };
|
||||
Loading…
Add table
Add a link
Reference in a new issue