Skip to content

Flatten an array of arrays into one or more. It flexible enough that you can dictate the maximum depth it unveils.

License

Notifications You must be signed in to change notification settings

SpiffGreen/flat-arr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flat Array

Flatten an array of arrays into one or more. It flexible enough that you can dictate the maximum depth it unveils.

Installation

In using npm in your project, run:

$ npm install flat-arr --save

Include the module to use

const flatArr = require("flat-arr");

Example

const arr = [
    [1, 2, 3],
    [4, 5, 6],
    7, 8, 9,
    [10, 
        [11,
            [12,
                [13, 14, 15]
            ],
        16,
        ],
        17,
    ],
    18
];

console.log(flatArr(arr, 3));
// [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, [ 13, 14, 15 ], 16, 17, 18 ]

console.log(flatArr(arr));
/* [
   1,  2,  3,  4,  5,  6,  7,
   8,  9, 10, 11, 12, 13, 14,
  15, 16, 17, 18
] */

Manual Release Steps

  • Increment the "version" attribute of package.json
  • Commit with the message "Release version x.x.x"
  • Create version tag in git
  • Create a github release
  • Release on npm

Author

Spiff Jekey-Green

License

MIT License

About

Flatten an array of arrays into one or more. It flexible enough that you can dictate the maximum depth it unveils.

Topics

Resources

License

Stars

Watchers

Forks