summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/array/#/flatten.js
blob: 4bf267f2bad8d900bd8629c4fc3776f3c0b523b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';

var isArray = Array.isArray, forEach = Array.prototype.forEach;

module.exports = function flatten() {
	var r = [];
	forEach.call(this, function (x) {
		if (isArray(x)) {
			r = r.concat(flatten.call(x));
		} else {
			r.push(x);
		}
	});
	return r;
};