|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
489 bytes
|
| Line | |
|---|
| 1 | var baseFlatten = require('./_baseFlatten');
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * Flattens `array` a single level deep.
|
|---|
| 5 | *
|
|---|
| 6 | * @static
|
|---|
| 7 | * @memberOf _
|
|---|
| 8 | * @since 0.1.0
|
|---|
| 9 | * @category Array
|
|---|
| 10 | * @param {Array} array The array to flatten.
|
|---|
| 11 | * @returns {Array} Returns the new flattened array.
|
|---|
| 12 | * @example
|
|---|
| 13 | *
|
|---|
| 14 | * _.flatten([1, [2, [3, [4]], 5]]);
|
|---|
| 15 | * // => [1, 2, [3, [4]], 5]
|
|---|
| 16 | */
|
|---|
| 17 | function flatten(array) {
|
|---|
| 18 | var length = array == null ? 0 : array.length;
|
|---|
| 19 | return length ? baseFlatten(array, 1) : [];
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | module.exports = flatten;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.