skip.js 472 B

1234567891011121314151617181920
  1. 'use strict';
  2. var _require = require('../helpers/is'),
  3. isObject = _require.isObject;
  4. module.exports = function skip(number) {
  5. var _this = this;
  6. if (isObject(this.items)) {
  7. return new this.constructor(Object.keys(this.items).reduce(function (accumulator, key, index) {
  8. if (index + 1 > number) {
  9. accumulator[key] = _this.items[key];
  10. }
  11. return accumulator;
  12. }, {}));
  13. }
  14. return new this.constructor(this.items.slice(number));
  15. };