projects
/
yaffs-website
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Version 1
[yaffs-website]
/
node_modules
/
arr-flatten
/
index.js
1
/*!
2
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
3
*
4
* Copyright (c) 2014-2015, Jon Schlinkert.
5
* Licensed under the MIT License.
6
*/
7
8
'use strict';
9
10
module.exports = function flatten(arr) {
11
return flat(arr, []);
12
};
13
14
function flat(arr, res) {
15
var len = arr.length;
16
var i = -1;
17
18
while (len--) {
19
var cur = arr[++i];
20
if (Array.isArray(cur)) {
21
flat(cur, res);
22
} else {
23
res.push(cur);
24
}
25
}
26
return res;
27
}