🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

array-into-subarrays

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-into-subarrays

A non destructive and simple function that divide an array into multiples subarrays

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
7
-12.5%
Maintainers
1
Weekly downloads
 
Created
Source

Array into Subarrays

Build Status GitHub license npm version

Insert a array list and receive a new list (non destructive) with groups of elements (subarrays).

Installing

$ npm install array-into-subarrays --save

Usage


import arrayIntoSubarrays from 'array-into-subarrays';

const array = [1, 2, 3, 4, 5, 6, 7, 8, 9] // could be any data, and how much indexes do you want.

arrayIntoSubarrays(array, 4) // => [[1, 2, 3, 4], [5, 6, 7, 8], [9]];

// you can invoke the function in any part of your code, because is a non destructive function

Attributes

OptionDefaultTypeDescription
arrayno default valuearrayArray that will be divided.
limit4numberLength of subarrays.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Keywords

javascript

FAQs

Package last updated on 20 Apr 2017

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