From 6438385d6439eb16994eb041516b04c7a8d06731 Mon Sep 17 00:00:00 2001 From: Rocco Nicosia Date: Tue, 17 Mar 2015 15:20:24 -0400 Subject: [PATCH] Fix `_.zipObject` docs to more clearly demonstrate it as `_.pairs` inverse. [ci skip] --- doc/README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/README.md b/doc/README.md index 7f287b1af..5f98fbd2f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1588,9 +1588,12 @@ _.zip(['fred', 'barney'], [30, 40], [true, false]); ### `_.zipObject(props, [values=[]])` # [Ⓢ](https://github.com/lodash/lodash/blob/3.5.0/lodash.src.js#L5648 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") -Creates an object composed from arrays of property names and values. Provide -either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]` -or two arrays, one of property names and one of corresponding values. +The opposite of `_.pairs`; this method returns an object composed from arrays +of property names and values. + +Provide either a single two dimensional array, e.g. +`[[key1, value1], [key2, value2]]` or two arrays, one of property names and one +of corresponding values. #### Arguments 1. `props` *(Array)*: The property names. @@ -1603,6 +1606,9 @@ or two arrays, one of property names and one of corresponding values. ```js _.zipObject(['fred', 'barney'], [30, 40]); // => { 'fred': 30, 'barney': 40 } + +_.zipObject([['fred', 30], ['barney', 40]]); +// => { 'fred': 30, 'barney': 40 } ``` * * *