* Creates an object composed from arrays of `keys` and `values`. Provide * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` * or two arrays, one of `keys` and one of corresponding `values`. * * @static * @memberOf _ * @alias object * @
(keys, values)
| 40224 | * // => { 'fred': 30, 'barney': 40 } |
| 40225 | */ |
| 40226 | function zipObject(keys, values) { |
| 40227 | var index = -1, |
| 40228 | length = keys ? keys.length : 0, |
| 40229 | result = {}; |
| 40230 | |
| 40231 | if (!values && length && !isArray(keys[0])) { |
| 40232 | values = []; |
| 40233 | } |
| 40234 | while (++index < length) { |
| 40235 | var key = keys[index]; |
| 40236 | if (values) { |
| 40237 | result[key] = values[index]; |
| 40238 | } else if (key) { |
| 40239 | result[key[0]] = key[1]; |
| 40240 | } |
| 40241 | } |
| 40242 | return result; |
| 40243 | } |
| 40244 | |
| 40245 | /*--------------------------------------------------------------------------*/ |
| 40246 |