1.0.5 • Published 6 years ago

@kingjs/array.nested.to-array v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

@kingjs/array.nested.to-array

Returns an array containing the non-array leafs of a tree whose internal nodes are nested arrays.

Usage

Flatten nested arrays like this:

var toArray = require('@kingjs/array.nested.toArray');

var result = toArray([
  'a', [
    'b', [
      'c'
    ], 'd'
  ], 'e'
]);

result;

result:

[ 'a', 'b', 'c', 'd', 'e' ]

API

declare function toArray(
  target: any | any[]
): any[]

Parameters

  • target: An non-array leaf or an array of nested array nodes interspersed with non-array leafs.

Returns

Returns an array containing the non-array leafs of a tree whose internal nodes are nested arrays.

Install

With npm installed, run

$ npm install @kingjs/array.nested.to-array

License

MIT

Analytics

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago