MCPcopy Create free account
hub / github.com/denoland/std / #removeAtUnchecked

Method #removeAtUnchecked

data_structures/deque.ts:810–820  ·  view source on GitHub ↗

Extract value, close the gap, update length, and optionally shrink.

(index: number)

Source from the content-addressed store, hash-verified

808
809 /** Extract value, close the gap, update length, and optionally shrink. */
810 #removeAtUnchecked(index: number): T {
811 const val = this.#buffer[(this.#head + index) & this.#mask] as T;
812 if (index < this.#length - index - 1) {
813 this.#closeGapFromFront(index);
814 } else {
815 this.#closeGapFromBack(index);
816 }
817 this.#length--;
818 this.#maybeShrink();
819 return val;
820 }
821
822 /** Close the gap at `i` by shifting elements before it one slot toward the back. */
823 #closeGapFromFront(i: number): void {

Callers 2

removeFirstMethod · 0.95
removeAtMethod · 0.95

Calls 3

#closeGapFromFrontMethod · 0.95
#closeGapFromBackMethod · 0.95
#maybeShrinkMethod · 0.95

Tested by

no test coverage detected