groups-of

0.0.1 • Public • Published

groups-of

===========

Divides arrays into groups of a specified cardinality.

Build Status

Usage

var groupsOf = require('groups-of');
var array = [3,4,5,6,7];
 
groupsOf(3, array, function (group) {
  console.log('the group is %s', group);
});
 
// Outputs:
// the group is [3,4,5]
// the group is [6,7]

Even works with strings:

var string = "oh say can you say";
 
groupsOf(8, string, function (group) {
  console.log('the group is %s', group);
})
 
// Outputs:
// the group is "oh say c";
// the group is "an you s";
// the group is "ay";

install

npm install groups-of

LICENSE

Grouper! http://wacohi1960.com/pht/3/grouper_fish_b.jpg

Readme

Keywords

none

Package Sidebar

Install

npm i groups-of

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • aaron