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
31
frontend/node_modules/es-toolkit/dist/object/invert.js
generated
vendored
Normal file
31
frontend/node_modules/es-toolkit/dist/object/invert.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//#region src/object/invert.ts
|
||||
/**
|
||||
* Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.
|
||||
*
|
||||
* This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,
|
||||
* the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping
|
||||
* of the input object's key-value pairs.
|
||||
*
|
||||
* @template K - Type of the keys in the input object (string, number, symbol)
|
||||
* @template V - Type of the values in the input object (string, number, symbol)
|
||||
* @param obj - The input object whose keys and values are to be inverted
|
||||
* @returns A new object with keys and values inverted
|
||||
*
|
||||
* @example
|
||||
* invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }
|
||||
* invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }
|
||||
* invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }
|
||||
* invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }
|
||||
*/
|
||||
function invert(obj) {
|
||||
const result = {};
|
||||
const keys = Object.keys(obj);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const value = obj[key];
|
||||
result[value] = key;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//#endregion
|
||||
exports.invert = invert;
|
||||
Loading…
Add table
Add a link
Reference in a new issue