JSPM

array-into-subarrays

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q22489F
  • License MIT

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

Package Exports

  • array-into-subarrays

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-into-subarrays) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Array into Subarrays

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 The text that will be truncated.
limit 4 number Length of subarrays.

License

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

Acknowledgments