Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Option Default Type Description
array no default value array Array that will be divided.
limit 4 number Length of subarrays.

License

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

Acknowledgments

About

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

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages