DieselDepot-APP/node_modules/es-toolkit/dist/compat/util/method.d.mts
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

23 lines
No EOL
695 B
TypeScript

//#region src/compat/util/method.d.ts
/**
* Creates a function that invokes the method at `path` of a given object with the provided arguments.
*
* @param path - The path of the method to invoke.
* @param args - The arguments to invoke the method with.
* @returns Returns a new function that takes an object and invokes the method at `path` with `args`.
*
* @example
* const object = {
* a: {
* b: function (x, y) {
* return x + y;
* }
* }
* };
*
* const add = method('a.b', 1, 2);
* console.log(add(object)); // => 3
*/
declare function method(path: PropertyKey | readonly PropertyKey[], ...args: any[]): (object: any) => any;
//#endregion
export { method };