Skip to content

Commit

Permalink
rêver flatten modification
Browse files Browse the repository at this point in the history
  • Loading branch information
Offir Golan committed Mar 5, 2016
1 parent 83ee324 commit b43fad5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/utils/flatten.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

export default function flatten(array = []) {
let result = [];
for(let item of array) {

for (var i = 0, l = array.length; i < l; i++) {
let item = array[i];

if (Array.isArray(item)) {
result = result.concat(flatten(item));
} else {
result.push(item);
}
}

return result;
}

0 comments on commit b43fad5

Please sign in to comment.