my-idlers/node_modules/collect.js/dist/methods/nth.js
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

15 lines
367 B
JavaScript
Vendored

'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);
};