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
38
frontend/node_modules/es-toolkit/dist/set/keyBy.mjs
generated
vendored
Normal file
38
frontend/node_modules/es-toolkit/dist/set/keyBy.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
//#region src/set/keyBy.ts
|
||||
/**
|
||||
* Maps each element of a Set based on a provided key-generating function.
|
||||
*
|
||||
* This function takes a Set and a function that generates a key from each value.
|
||||
* It returns a new Map where the keys are generated by the key function and the values are
|
||||
* the corresponding values from the original set. If multiple elements produce the same key,
|
||||
* the last value encountered will be used.
|
||||
*
|
||||
* @template T - The type of elements in the Set.
|
||||
* @template K - The type of keys to produce in the returned Map.
|
||||
* @param set - The set of elements to be mapped.
|
||||
* @param getKeyFromValue - A function that generates a key from a value.
|
||||
* @returns A Map where the generated keys are mapped to each element's value.
|
||||
*
|
||||
* @example
|
||||
* const set = new Set([
|
||||
* { type: 'fruit', name: 'apple' },
|
||||
* { type: 'fruit', name: 'banana' },
|
||||
* { type: 'vegetable', name: 'carrot' }
|
||||
* ]);
|
||||
* const result = keyBy(set, item => item.type);
|
||||
* // result will be:
|
||||
* // Map(2) {
|
||||
* // 'fruit' => { type: 'fruit', name: 'banana' },
|
||||
* // 'vegetable' => { type: 'vegetable', name: 'carrot' }
|
||||
* // }
|
||||
*/
|
||||
function keyBy(set, getKeyFromValue) {
|
||||
const result = /* @__PURE__ */ new Map();
|
||||
for (const value of set) {
|
||||
const newKey = getKeyFromValue(value, value, set);
|
||||
result.set(newKey, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//#endregion
|
||||
export { keyBy };
|
||||
Loading…
Add table
Add a link
Reference in a new issue