Divides arrays or strings into sub-groups of a given cardinality
Divides arrays into groups of a specified cardinality.
var groupsOf = require'groups-of';var array = 34567;groupsOf3 arrayconsole.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";groupsOf8 stringconsole.log'the group is %s' group;// Outputs:// the group is "oh say c";// the group is "an you s";// the group is "ay";
npm install groups-of