summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/lodash/unzip.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-02-15 14:45:53 -0800
committerRich Trott <rtrott@gmail.com>2016-02-18 10:13:13 -0800
commitd7aa8fa088f3b8a31c7d85c6d71824c8c60e7c17 (patch)
tree739f4a86de562584f10eba7f1a06a406d8d66366 /tools/eslint/node_modules/lodash/unzip.js
parentd3c3a928c3a2f9e961881b47ef0796e57ae8d429 (diff)
downloadnode-new-d7aa8fa088f3b8a31c7d85c6d71824c8c60e7c17.tar.gz
tools: update ESLint to version 2.1.0
Update ESLint to 2.1.0. ESLint has a number of potentially-useful new features but this change attempts to be minimal in its changes. However, some things could not be avoided reasonably. ESLint 2.1.0 found a few lint issues that ESLing 1.x missed with template strings that did not take advantage of any features of template strings, and `let` declarations where `const` sufficed. Additionally, ESLint 2.1.0 removes some granularity around enabling ES6 features. Some features (e.g., spread operator) that had been turned off in our configuration for ESLint 1.x are now permitted. PR-URL: https://github.com/nodejs/node/pull/5214 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'tools/eslint/node_modules/lodash/unzip.js')
-rw-r--r--tools/eslint/node_modules/lodash/unzip.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/lodash/unzip.js b/tools/eslint/node_modules/lodash/unzip.js
new file mode 100644
index 0000000000..0dddd4447b
--- /dev/null
+++ b/tools/eslint/node_modules/lodash/unzip.js
@@ -0,0 +1,44 @@
+var arrayFilter = require('./_arrayFilter'),
+ arrayMap = require('./_arrayMap'),
+ baseProperty = require('./_baseProperty'),
+ baseTimes = require('./_baseTimes'),
+ isArrayLikeObject = require('./isArrayLikeObject');
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeMax = Math.max;
+
+/**
+ * This method is like `_.zip` except that it accepts an array of grouped
+ * elements and creates an array regrouping the elements to their pre-zip
+ * configuration.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array of grouped elements to process.
+ * @returns {Array} Returns the new array of regrouped elements.
+ * @example
+ *
+ * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
+ * // => [['fred', 30, true], ['barney', 40, false]]
+ *
+ * _.unzip(zipped);
+ * // => [['fred', 'barney'], [30, 40], [true, false]]
+ */
+function unzip(array) {
+ if (!(array && array.length)) {
+ return [];
+ }
+ var length = 0;
+ array = arrayFilter(array, function(group) {
+ if (isArrayLikeObject(group)) {
+ length = nativeMax(group.length, length);
+ return true;
+ }
+ });
+ return baseTimes(length, function(index) {
+ return arrayMap(array, baseProperty(index));
+ });
+}
+
+module.exports = unzip;