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
50
frontend/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js
generated
vendored
Normal file
50
frontend/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
const require_zip = require("../../array/zip.js");
|
||||
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
||||
const require_set = require("../object/set.js");
|
||||
//#region src/compat/array/zipObjectDeep.ts
|
||||
/**
|
||||
* Creates a deeply nested object given arrays of paths and values.
|
||||
*
|
||||
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
||||
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
||||
* Paths can be dot-separated strings or arrays of property names.
|
||||
*
|
||||
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
||||
*
|
||||
* @template P - The type of property paths.
|
||||
* @template V - The type of values corresponding to the property paths.
|
||||
* @param keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
||||
* @param values - An array of values corresponding to the property paths.
|
||||
* @returns A new object composed of the given property paths and values.
|
||||
*
|
||||
* @example
|
||||
* const paths = ['a.b.c', 'd.e.f'];
|
||||
* const values = [1, 2];
|
||||
* const result = zipObjectDeep(paths, values);
|
||||
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
||||
*
|
||||
* @example
|
||||
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
||||
* const values = [1, 2];
|
||||
* const result = zipObjectDeep(paths, values);
|
||||
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
||||
*
|
||||
* @example
|
||||
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
||||
* const values = [1, 2];
|
||||
* const result = zipObjectDeep(paths, values);
|
||||
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
||||
*/
|
||||
function zipObjectDeep(keys, values) {
|
||||
const result = {};
|
||||
if (!require_isArrayLike.isArrayLike(keys)) return result;
|
||||
if (!require_isArrayLike.isArrayLike(values)) values = [];
|
||||
const zipped = require_zip.zip(Array.from(keys), Array.from(values));
|
||||
for (let i = 0; i < zipped.length; i++) {
|
||||
const [key, value] = zipped[i];
|
||||
if (key != null) require_set.set(result, key, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//#endregion
|
||||
exports.zipObjectDeep = zipObjectDeep;
|
||||
Loading…
Add table
Add a link
Reference in a new issue