Skip to content

Instantly share code, notes, and snippets.

@colinhicks
Last active December 11, 2015 03:38
Show Gist options
  • Save colinhicks/4539036 to your computer and use it in GitHub Desktop.
Save colinhicks/4539036 to your computer and use it in GitHub Desktop.
LINQ-influenced skip/take for Underscore
_.mixin({
skipTake: function(array, options) {
options = _.extend({skip:0, take:0}, options || {});
return _(array)
.chain()
.rest(options.skip)
.first(options.take || array.length - options.skip)
.value();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment