MCPcopy Index your code
hub / github.com/immutable-js/immutable-js / removeAfter

Method removeAfter

src/List.js:337–365  ·  view source on GitHub ↗
(ownerID, level, index)

Source from the content-addressed store, hash-verified

335 }
336
337 removeAfter(ownerID, level, index) {
338 if (
339 index === (level ? 1 << (level + SHIFT) : SIZE) ||
340 this.array.length === 0
341 ) {
342 return this;
343 }
344 const sizeIndex = ((index - 1) >>> level) & MASK;
345 if (sizeIndex >= this.array.length) {
346 return this;
347 }
348
349 let newChild;
350 if (level > 0) {
351 const oldChild = this.array[sizeIndex];
352 newChild =
353 oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
354 if (newChild === oldChild && sizeIndex === this.array.length - 1) {
355 return this;
356 }
357 }
358
359 const editable = editableVNode(this, ownerID);
360 editable.array.splice(sizeIndex + 1);
361 if (newChild) {
362 editable.array[sizeIndex] = newChild;
363 }
364 return editable;
365 }
366}
367
368const DONE = {};

Callers 1

setListBoundsFunction · 0.80

Calls 2

editableVNodeFunction · 0.85
spliceMethod · 0.80

Tested by

no test coverage detected