|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
345 bytes
|
| Line | |
|---|
| 1 | module.exports = function (xs, fn) {
|
|---|
| 2 | var res = [];
|
|---|
| 3 | for (var i = 0; i < xs.length; i++) {
|
|---|
| 4 | var x = fn(xs[i], i);
|
|---|
| 5 | if (isArray(x)) res.push.apply(res, x);
|
|---|
| 6 | else res.push(x);
|
|---|
| 7 | }
|
|---|
| 8 | return res;
|
|---|
| 9 | };
|
|---|
| 10 |
|
|---|
| 11 | var isArray = Array.isArray || function (xs) {
|
|---|
| 12 | return Object.prototype.toString.call(xs) === '[object Array]';
|
|---|
| 13 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.