Welcome to mirror list, hosted at ThFree Co, Russian Federation.

flatten.js « # « array « es5-ext « node_modules « eslint « tools - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c95407d317fd3b8e6e9435ae16cc2ed63b713dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
'use strict';

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

module.exports = function flatten() {
	var r = [];
	forEach.call(this, function (x) {
		push.apply(r, isArray(x) ? flatten.call(x) : [x]);
	});
	return r;
};