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.

14 lines
407 B

4 years ago
  1. 'use strict';
  2. module.exports = function splice(index, limit, replace) {
  3. var slicedCollection = this.slice(index, limit);
  4. this.items = this.diff(slicedCollection.all()).all();
  5. if (Array.isArray(replace)) {
  6. for (var iterator = 0, length = replace.length; iterator < length; iterator += 1) {
  7. this.items.splice(index + iterator, 0, replace[iterator]);
  8. }
  9. }
  10. return slicedCollection;
  11. };