Skip to content

Instantly share code, notes, and snippets.

@warpgate3
Created January 8, 2019 07:40
Show Gist options
  • Save warpgate3/7d4fa50e177ab38cb6de3b8f89c80ad8 to your computer and use it in GitHub Desktop.
Save warpgate3/7d4fa50e177ab38cb6de3b8f89c80ad8 to your computer and use it in GitHub Desktop.
var sequenceGrouping = function (data) {
return _.reduce(data, function (arr, val, i, a) {
if (!i || val != a[i - 1] + 1) {
arr.push([]);
}
arr[arr.length - 1].push(val);
return arr;
}, []);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment