🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

array-spread

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-spread

Concat a matrix array into one flattened array.

1.0.2
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

array-spread

Why

Concat a matrix array into one flattened array.

Installation

$ npm install --save array-spread

Usage

var arraySpread = require('array-spread');

var matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];

console.log(arraySpread(matrix));

// Output:
[1, 2, 3, 4, 5, 6, 7, 8, 9]

Test

npm test

How does it work?

var matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];

console.log([].concat.apply([], matrix));

// Output:
[1, 2, 3, 4, 5, 6, 7, 8, 9]

ES6

let matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];

console.log([...matrix]);
// Output:
[1, 2, 3, 4, 5, 6, 7, 8, 9]

Contribution

Contributions are appreciated.

License

MIT-licensed. See LICENSE.

Keywords

spread

FAQs

Package last updated on 15 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts