UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

31 lines (30 loc) 1.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.zipObject = void 0; const assignValue_1 = __importDefault(require("./.internal/assignValue")); const baseZipObject_1 = __importDefault(require("./.internal/baseZipObject")); /** * This method is like `fromPairs` except that it accepts two arrays, * one of property identifiers and one of corresponding values. * * @since 5.3.0 * @category Array * @param props The property identifiers. * @param values The property values. * @returns Returns the new object. * @see [[unzip]],[[unzipWith]],[[zip]],[[zipObjectDeep]],[[zipWith]] * @example * * ```js * zipObject(['a', 'b'], [1, 2]) * // => { 'a': 1, 'b': 2 } * ``` */ function zipObject(props, values) { return (0, baseZipObject_1.default)(props || [], values || [], assignValue_1.default); } exports.zipObject = zipObject; exports.default = zipObject;