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
40
frontend/node_modules/es-toolkit/dist/array/uniqBy.js
generated
vendored
Normal file
40
frontend/node_modules/es-toolkit/dist/array/uniqBy.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//#region src/array/uniqBy.ts
|
||||
/**
|
||||
* Returns a new array containing only the unique elements from the original array,
|
||||
* based on the values returned by the mapper function.
|
||||
*
|
||||
* When duplicates are found, the first occurrence is kept and the rest are discarded.
|
||||
*
|
||||
* @template T - The type of elements in the array.
|
||||
* @template U - The type of mapped elements.
|
||||
* @param arr - The array to process.
|
||||
* @param mapper - The function used to convert the array elements.
|
||||
* @returns A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
|
||||
* // [1.2, 2.1, 3.2, 5.7, 7.19]
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* const array = [
|
||||
* { category: 'fruit', name: 'apple' },
|
||||
* { category: 'fruit', name: 'banana' },
|
||||
* { category: 'vegetable', name: 'carrot' },
|
||||
* ];
|
||||
* uniqBy(array, item => item.category).length
|
||||
* // 2
|
||||
* ```
|
||||
*/
|
||||
function uniqBy(arr, mapper) {
|
||||
const map = /* @__PURE__ */ new Map();
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const item = arr[i];
|
||||
const key = mapper(item, i, arr);
|
||||
if (!map.has(key)) map.set(key, item);
|
||||
}
|
||||
return Array.from(map.values());
|
||||
}
|
||||
//#endregion
|
||||
exports.uniqBy = uniqBy;
|
||||
Loading…
Add table
Add a link
Reference in a new issue