0.0.1 • Published 12 years ago

groups-of v0.0.1

Weekly downloads
2
License
-
Repository
github
Last release
12 years ago

#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