UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

38 lines (37 loc) 1.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.invoke = void 0; const baseInvoke_1 = __importDefault(require("./.internal/baseInvoke")); const baseRest_1 = __importDefault(require("./.internal/baseRest")); /** * @ignore * @internal * @private */ const internalInvoke = (0, baseRest_1.default)(baseInvoke_1.default); /** * Invokes the method at `path` of `object`. * * @since 5.7.0 * @category Object * @param object The object to query. * @param path The path of the method to invoke. * @param args The arguments to invoke the method with. * @returns Returns the result of the invoked method. * @example * * ```js * const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] } * * invoke(object, 'a[0].b.c.slice', [1, 3]) * // => [2, 3] * ``` */ function invoke(object, path, ...args) { return internalInvoke(object, path, ...args); } exports.invoke = invoke; exports.default = invoke;