import { Vector } from "https://deno.land/x/collections@v0.6.1/vector.ts";
A double-ended queue implemented with a growable ring buffer. Vector is faster than JavaScript's built in Array class for shifting and unshifting because it only requires reallocation when increasing the capacity.
Properties
Methods
Removes and returns the value at index from the vector. If the value is negative, it will be subtracted from the end. The values between the index and the end will be shifted to the left.
Returns an iterator for retrieving and removing values from the vector (from right-to-left).
Returns the value at the given index. If the value is negative, it will be subtracted from the end. The index 0 would return the first value in the vector. The index -1 would return the last value in the vector.
Applies a function against an accumulator and each value of the vector (from left-to-right) to reduce it to a single value. If no initial value is supplied, the first value in the vector will be used and skipped. Calling reduce on an empty array without an initial value creates a TypeError.
Applies a function against an accumulator and each value of the vector (from right-to-left) to reduce it to a single value. If no initial value is supplied, the last value in the vector will be used and skipped. Calling reduce on an empty array without an initial value creates a TypeError.
Sets the value at the given index, then returns the value. If the value is negative, it will be subtracted from the end. The index 0 would set the first value in the vector. The index -1 would set the last value in the vector. If the absolute index value is greater than the length, the size will be increased to match before setting the value.
Returns an iterator for retrieving values from the vector (from right-to-left).
Returns an iterator for retrieving values from the vector (from left-to-right).