You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
367 B

4 years ago
'use strict';
var values = require('../helpers/values');
module.exports = function nth(n) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var items = values(this.items);
var collection = items.slice(offset).filter(function (item, index) {
return index % n === 0;
});
return new this.constructor(collection);
};