1.0.3 • Published 5 years ago

mikeporter-twig-coding-challenge v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Twig Coding Challenge

npm version

My submission for the Twig coding challenge.

This library provides a function to split an array of type T[] into an array of arrays (T) where the maximum size of an internal array is the splitSize given.

If the array cannot be divided equally by the splitSize, the final array will contain the remainder.

Example usage

Install via npm install mikeporter-twig-coding-challenge

Usage:

import {splitArray} from 'mikeporter-twig-coding-challenge';

splitArray([1, 2, 3, 4], 2);
// [[1, 2], [3, 4]]

splitArray([1, 2, 3], 2);
// [[1, 2], [3]]

Checking out project and running tests

git clone https://github.com/mikeporterdev/twig-coding-challenge
cd twig-coding-challenge
npm install
npm test
npm run compile