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;
};
|