reports/frontend/node_modules/es-toolkit/dist/compat/util/methodOf.js
jtricerolph 1c411e402e Add settings page for managing forecasting API key and URL via UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 14:37:36 +00:00

28 lines
729 B
JavaScript

const require_invoke = require("./invoke.js");
//#region src/compat/util/methodOf.ts
/**
* Creates a function that invokes the method at a given path of `object` with the provided arguments.
*
* @param object - The object to query.
* @param args - The arguments to invoke the method with.
* @returns Returns a new function that takes a path and invokes the method at `path` with `args`.
*
* @example
* const object = {
* a: {
* b: function (x, y) {
* return x + y;
* }
* }
* };
*
* const add = methodOf(object, 1, 2);
* console.log(add('a.b')); // => 3
*/
function methodOf(object, ...args) {
return function(path) {
return require_invoke.invoke(object, path, args);
};
}
//#endregion
exports.methodOf = methodOf;