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
39
frontend/node_modules/es-toolkit/dist/compat/array/findLast.mjs
generated
vendored
Normal file
39
frontend/node_modules/es-toolkit/dist/compat/array/findLast.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { identity } from "../../function/identity.mjs";
|
||||
import { iteratee } from "../util/iteratee.mjs";
|
||||
import { toInteger } from "../util/toInteger.mjs";
|
||||
//#region src/compat/array/findLast.ts
|
||||
/**
|
||||
* Finds the last item in an object that has a specific property, where the property name is provided as a PropertyKey.
|
||||
*
|
||||
* @template T
|
||||
* @param source - The source array or object to search through.
|
||||
* @param doesMatch - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name.
|
||||
* @param [fromIndex] - The index to start the search from, defaults to source.length-1 for arrays or Object.keys(source).length-1 for objects.
|
||||
* @returns The last property value that has the specified property, or `undefined` if no match is found.
|
||||
*
|
||||
* @example
|
||||
* // Using a property name
|
||||
* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2 }, c: { id: 3, name: 'Bob' } };
|
||||
* const result = findLast(obj, 'name');
|
||||
* console.log(result); // { id: 3, name: 'Bob' }
|
||||
*/
|
||||
function findLast(source, _doesMatch = identity, fromIndex) {
|
||||
if (!source) return;
|
||||
const length = Array.isArray(source) ? source.length : Object.keys(source).length;
|
||||
fromIndex = toInteger(fromIndex ?? length - 1);
|
||||
if (fromIndex < 0) fromIndex = Math.max(length + fromIndex, 0);
|
||||
else fromIndex = Math.min(fromIndex, length - 1);
|
||||
const doesMatch = iteratee(_doesMatch);
|
||||
if (!Array.isArray(source)) {
|
||||
const keys = Object.keys(source);
|
||||
for (let i = fromIndex; i >= 0; i--) {
|
||||
const key = keys[i];
|
||||
const value = source[key];
|
||||
if (doesMatch(value, key, source)) return value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return source.slice(0, fromIndex + 1).findLast(doesMatch);
|
||||
}
|
||||
//#endregion
|
||||
export { findLast };
|
||||
Loading…
Add table
Add a link
Reference in a new issue