1.0.6 • Published 2 years ago

chunktools v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ChunkTools

ChunkTools is a lightweight and intuitive tool for deconstructing large arrays into smaller, more manageable arrays for chunk processing with or without promises.

Installation

Using npm:

npm i chunktools

Importing jsonlitedb to your Node Project:

const chunktools = require(‘chunktools’)

Usage

Chunktools features two functions:

makeChunksFromArray

Returns “chunks”/arrays of your designated size with the contents of your provided array distributed between them.

This function has two mandatory parameters: 1. your array 2. The size of the “chunks” you’d like to distribute your array into.

Example

let myArray = [0,1,2,3,4,5,6,7,8,9,10] 

makeChunksFromArray(myArray, 10) //Expected return: [[0],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]]`

makeChunksFromRange

Returns “chunks”/arrays of your designated size containing all the integers contained in your provided range.

This function has three mandatory parameters: 1. From 2. To 3. The size of the “chunks” you’d like to distribute your array into.

Parameter 1 & 2 pertain to your range, so for example, if we want an array from 1 - 10 broken down into chunks that each contain one number, this is what it would look like:

makeChunksFromRange(1, 10, 1)

With the expected return being:

[[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]]
1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago