<commit_before>Chunkify
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Segments an array into chunks.


## Installation

``` bash
$ npm install compute-chunkify
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

To use the module,

``` javascript
var chunkify = require( 'compute-chunkify' );
```

#### chunkify( arr, n[, opts] )

Segments an `array` into chunks of length `n`.

``` javascript
var data = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];

var out = chunkify( data, 3 );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9],
		[10,null,null]
	]
*/
```

The function is configurable and has the following options...

##### _start_

`Integer` specifying the index from which to begin chunking.

``` javascript
var opts = {
	'start': 2
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[2,3,4],
		[5,6,7],
		[8,9,10]
	]
*/
```


##### _truncate_

`Boolean` specifying whether the last chunk must contain only `array` values and no padded values.

``` javascript
var opts = {
	'truncate': true
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9]
	]
*/
```

##### _padding_

By default, if the `array` length is not evenly divisible by `n`, the last chunk is padded with `null` values. To turn off padding, set this option to `false`.

``` javascript
var opts = {
	'padding': false
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9],
		[10]
	]
*/
```

##### _padding_value_

Set this option to pad with a value other than `null`.

``` javascript
var opts = {
	'padding_value': 0
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9],
		[10,0,0]
	]
*/
```

##### _delay_

By default, an `array` is chunked beginning with the first `array` element. Set this option to pad the first chunk, where `0 < delay < n`.

``` javascript
var opts = {
	'delay': 2
};

var out = chunkify( data, 3, opts );
/* returns 
	[
		[null,null,1],
		[2,3,4],
		[5,6,7],
		[8,9,10]
	]
*/
```

##### _overlap_

By default, the array is segmented into adjacent chunks (no overlap and no underlap). To create overlapping chunks, set the overlap option such that `0 < overlap < n`,
<commit_msg>[UPDATE] README.<commit_after>Chunkify
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Segments an array into chunks.


## Installation

``` bash
$ npm install compute-chunkify
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

To use the module,

``` javascript
var chunkify = require( 'compute-chunkify' );
```

#### chunkify( arr, n[, opts] )

Segments an `array` into chunks of length `n`.

``` javascript
var data = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];

var out = chunkify( data, 3 );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9],
		[10,null,null]
	]
*/
```

The function is configurable and has the following options...

##### _start_

`Integer` specifying the index from which to begin chunking. Default: `0`.

``` javascript
var opts = {
	'start': 2
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[2,3,4],
		[5,6,7],
		[8,9,10]
	]
*/
```


##### _truncate_

`Boolean` specifying whether the last chunk must contain only `array` values and no padded values. Default: `false`.

``` javascript
var opts = {
	'truncate': true
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9]
	]
*/
```

##### _padding_

By default, if the `array` length is not evenly divisible by `n`, the last chunk is padded with `null` values. Default: `true`.

To turn off padding, set this option to `false`.

``` javascript
var opts = {
	'padding': false
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9],
		[10]
	]
*/
```

##### _padding_value_

The default padding value is `null`. Set this option to pad with a value other than `null`.

``` javascript
var opts = {
	'padding_value': 0
};

var out = chunkify( data, 3, opts );
/* returns
	[
		[1,2,3],
		[4,5,6],
		[7,8,9],
		[10,0,0]
	]
*/
```

##### _delay_

By default, an `array` is chunked beginning with the first `array` element. Default: `0`.

Set this option to pad the first chunk, where `0 < delay < n`.

``` javascript
var opts = {
	'delay': 2
};

var out = chunkify( data, 3, opts );
/* returns 
	[
		[null,null,1],
		[2,3,4],
		[5,6,7],
		[8,9,10]
	]
*/
```

##### _overlap_

By default, the array is segmented into adjacent chunks (no overlap and no underlap). Default: `0`.

To create overlapping chunks, set the overlap option such that `0 < overlap < n`,

{'fraction_non_alphanumeric': 0.1873970345963756, 'fraction_numerical': 0.0364497528830313, 'mean_word_length': 3.6522988505747125, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1230544', 'n_tokens_mistral': 2026, 'n_tokens_neox': 1824, 'n_words': 573}