Created
January 8, 2019 07:40
-
-
Save warpgate3/7d4fa50e177ab38cb6de3b8f89c80ad8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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