prelude/typed_array
API referenceArrayBuffer, DataView and the typed arrays Uint8Array, Int8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array and Float64Array are globals, as in Node (no import; the module is velt/lang/typed_array). They behave as in Node 22: the same conversions, errors and console.log / JSON.stringify output. For a walkthrough, read the guide.
Exports
ArrayBuffer).DataViewA view of a byte range of an ArrayBuffer for numbers of any size at any offset (JS DataView): getUint16(offset, littleEndian), setFloat64(offset, value, littleEndian), ….Int8ArrayAn array of 8-bit signed integers in an ArrayBuffer (JS Int8Array): new Int8Array(n) (n zeros), new Int8Array([1, 2]) (a copy, converted), new Int8Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Uint8ArrayAn array of 8-bit unsigned integers (bytes) in an ArrayBuffer (JS Uint8Array): new Uint8Array(n) (n zeros), new Uint8Array([1, 2]) (a copy, converted), new Uint8Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Uint8ClampedArrayAn array of 8-bit unsigned integers, clamped to 0..255 when written in an ArrayBuffer (JS Uint8ClampedArray): new Uint8ClampedArray(n) (n zeros), new Uint8ClampedArray([1, 2]) (a copy, converted), new Uint8ClampedArray(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Int16ArrayAn array of 16-bit signed integers in an ArrayBuffer (JS Int16Array): new Int16Array(n) (n zeros), new Int16Array([1, 2]) (a copy, converted), new Int16Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Uint16ArrayAn array of 16-bit unsigned integers in an ArrayBuffer (JS Uint16Array): new Uint16Array(n) (n zeros), new Uint16Array([1, 2]) (a copy, converted), new Uint16Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Int32ArrayAn array of 32-bit signed integers in an ArrayBuffer (JS Int32Array): new Int32Array(n) (n zeros), new Int32Array([1, 2]) (a copy, converted), new Int32Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Uint32ArrayAn array of 32-bit unsigned integers in an ArrayBuffer (JS Uint32Array): new Uint32Array(n) (n zeros), new Uint32Array([1, 2]) (a copy, converted), new Uint32Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Float32ArrayAn array of 32-bit floats (f32) in an ArrayBuffer (JS Float32Array): new Float32Array(n) (n zeros), new Float32Array([1, 2]) (a copy, converted), new Float32Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Float64ArrayAn array of 64-bit floats (numbers) in an ArrayBuffer (JS Float64Array): new Float64Array(n) (n zeros), new Float64Array([1, 2]) (a copy, converted), new Float64Array(buffer, byteOffset, length) (a view of buffer, sharing it), or a copy of another typed array.Re-exported from velt/lang/typed_array/core
A fixed-length block of bytes (JS ArrayBuffer). Read and write it through a view:
new Uint8Array(buffer), new DataView(buffer), or any other typed array.
Parameter ofDataView.constructorFloat32Array.constructorFloat64Array.constructorInt8Array.constructorUint8Array.constructorUint8ClampedArray.constructorInt16Array.constructorUint16Array.constructorand 2 moreReturned byDataView.bufferFloat32Array.bufferFloat64Array.bufferInt8Array.bufferUint8Array.bufferUint8ClampedArray.bufferInt16Array.bufferUint16Array.bufferand 2 moreUsed byvelt/net/httpBodyInit
constructor(byteLength: number = 0)byteLength zero bytes (RangeError for a negative or non-integer length beyond 2^53).
get byteLength(): numberThe number of bytes.
get resizable(): boolThe length cannot change (JS: false unless made with maxByteLength).
get maxByteLength(): numberThe most bytes it can hold: its byteLength, since it is not resizable.
get detached(): boolWhether the buffer was transferred away (never: Velt has no transfer yet).
slice(begin: number = 0, end: number = Infinity): ArrayBufferA new buffer with a copy of the bytes in [begin, end); negative positions count from the
end, as for an array's slice.
static isView(v: unknown): v is ArrayBufferViewWhether v is a view of a buffer: a typed array or a DataView.
toJSON(): Record<string, number>JSON.stringify writes an ArrayBuffer as {}, as in JS.
toString(): string"[object ArrayBuffer]", as String(buffer) gives in JS.
[ [INSPECT](): NativeInspectHow console.log shows the buffer, like Node: ArrayBuffer { [Uint8Contents]: <00 ff>, [byteLength]: 2 }.
Re-exported from velt/lang/typed_array/data_view
class DataView extends BufferViewA view of a byte range of an ArrayBuffer for numbers of any size at any offset (JS
DataView): getUint16(offset, littleEndian), setFloat64(offset, value, littleEndian), ….
Multi-byte values are big-endian unless littleEndian is true, as in JS. An access outside
the view throws a RangeError.
constructor(buffer: ArrayBuffer, byteOffset: number = 0, byteLength?: number)A view of buffer from byteOffset, of byteLength bytes or up to its end; RangeError
as in JS when the range is outside the buffer.
get buffer(): ArrayBufferThe buffer the view is of.
get byteOffset(): numberWhere the view starts in buffer, in bytes.
get byteLength(): numberThe size of the view in bytes.
getInt8(byteOffset: number): numberThe signed byte at byteOffset.
getUint8(byteOffset: number): numberThe byte at byteOffset.
getInt16(byteOffset: number, littleEndian: bool = false): numberThe 16-bit signed integer at byteOffset.
getUint16(byteOffset: number, littleEndian: bool = false): numberThe 16-bit unsigned integer at byteOffset.
getInt32(byteOffset: number, littleEndian: bool = false): numberThe 32-bit signed integer at byteOffset.
getUint32(byteOffset: number, littleEndian: bool = false): numberThe 32-bit unsigned integer at byteOffset.
getFloat32(byteOffset: number, littleEndian: bool = false): numberThe 32-bit float at byteOffset.
getFloat64(byteOffset: number, littleEndian: bool = false): numberThe 64-bit float (number) at byteOffset.
setInt8(byteOffset: number, value: number)Writes value as a signed byte (wrapped, as JS's ToInt8).
setUint8(byteOffset: number, value: number)Writes value as a byte (wrapped, as JS's ToUint8).
setInt16(byteOffset: number, value: number, littleEndian: bool = false)Writes value as a 16-bit integer (wrapped).
setUint16(byteOffset: number, value: number, littleEndian: bool = false)Writes value as a 16-bit unsigned integer (wrapped).
setInt32(byteOffset: number, value: number, littleEndian: bool = false)Writes value as a 32-bit integer (wrapped).
setUint32(byteOffset: number, value: number, littleEndian: bool = false)Writes value as a 32-bit unsigned integer (wrapped).
setFloat32(byteOffset: number, value: number, littleEndian: bool = false)Writes value as a 32-bit float (rounded).
setFloat64(byteOffset: number, value: number, littleEndian: bool = false)Writes value as a 64-bit float.
[ [VIEW_EMPTY_TEXT](): stringNo doc comment yettoString(): string"[object DataView]", as String(view) gives in JS.
toJSON(): Record<string, number>JSON.stringify writes a DataView as {}, as in JS.
[ [INSPECT](): NativeInspectHow console.log shows the view, like Node (its length, offset and buffer).
Re-exported from velt/lang/typed_array/int8_array
class Int8Array extends TypedArray implements Iterable<number>An array of 8-bit signed integers in an ArrayBuffer (JS Int8Array): new Int8Array(n) (n zeros),
new Int8Array([1, 2]) (a copy, converted), new Int8Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 1The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 1), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Int8ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Int8ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Int8Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Int8Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Int8ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Int8ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Int8ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Int8ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Int8ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Int8ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Int8ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Int8Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Int8ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Int8Array(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/uint8_array
class Uint8Array extends TypedArray implements Iterable<number>An array of 8-bit unsigned integers (bytes) in an ArrayBuffer (JS Uint8Array): new Uint8Array(n) (n zeros),
new Uint8Array([1, 2]) (a copy, converted), new Uint8Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
Parameter ofvelt/netTcpStream.readInto
static readonly BYTES_PER_ELEMENT: number = 1The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 1), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Uint8ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Uint8ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Uint8Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Uint8Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Uint8ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Uint8ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Uint8ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Uint8ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Uint8ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint8ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Uint8ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Uint8Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Uint8ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Uint8Array(2) [ 1, 2 ].
static fromBytes(bytes: u8[]): Uint8ArrayA Uint8Array of a copy of bytes (Velt: u8[] is Velt's byte array, as in velt/crypto
and velt/encoding). A copy, so the buffer keeps its length whatever happens to bytes.
toBytes(): u8[]A copy of the elements as a u8[] (Velt's byte array, for velt/crypto and the like).
Re-exported from velt/lang/typed_array/uint8_clamped_array
class Uint8ClampedArray extends TypedArray implements Iterable<number>An array of 8-bit unsigned integers, clamped to 0..255 when written in an ArrayBuffer (JS Uint8ClampedArray): new Uint8ClampedArray(n) (n zeros),
new Uint8ClampedArray([1, 2]) (a copy, converted), new Uint8ClampedArray(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 1The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 1), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Uint8ClampedArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Uint8ClampedArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Uint8ClampedArray throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Uint8ClampedArray throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Uint8ClampedArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Uint8ClampedArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Uint8ClampedArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Uint8ClampedArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Uint8ClampedArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint8ClampedArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Uint8ClampedArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Uint8ClampedArray throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Uint8ClampedArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Uint8ClampedArray(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/int16_array
class Int16Array extends TypedArray implements Iterable<number>An array of 16-bit signed integers in an ArrayBuffer (JS Int16Array): new Int16Array(n) (n zeros),
new Int16Array([1, 2]) (a copy, converted), new Int16Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 2The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 2), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Int16ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Int16ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Int16Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Int16Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Int16ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Int16ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Int16ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Int16ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Int16ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Int16ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Int16ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Int16Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Int16ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Int16Array(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/uint16_array
class Uint16Array extends TypedArray implements Iterable<number>An array of 16-bit unsigned integers in an ArrayBuffer (JS Uint16Array): new Uint16Array(n) (n zeros),
new Uint16Array([1, 2]) (a copy, converted), new Uint16Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 2The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 2), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Uint16ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Uint16ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Uint16Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Uint16Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Uint16ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Uint16ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Uint16ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Uint16ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Uint16ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint16ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Uint16ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Uint16Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Uint16ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Uint16Array(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/int32_array
class Int32Array extends TypedArray implements Iterable<number>An array of 32-bit signed integers in an ArrayBuffer (JS Int32Array): new Int32Array(n) (n zeros),
new Int32Array([1, 2]) (a copy, converted), new Int32Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 4The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 4), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Int32ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Int32ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Int32Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Int32Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Int32ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Int32ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Int32ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Int32ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Int32ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Int32ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Int32ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Int32Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Int32ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Int32Array(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/uint32_array
class Uint32Array extends TypedArray implements Iterable<number>An array of 32-bit unsigned integers in an ArrayBuffer (JS Uint32Array): new Uint32Array(n) (n zeros),
new Uint32Array([1, 2]) (a copy, converted), new Uint32Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 4The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 4), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Uint32ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Uint32ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Uint32Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Uint32Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Uint32ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Uint32ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Uint32ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Uint32ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Uint32ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint32ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Uint32ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Uint32Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Uint32ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Uint32Array(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/float32_array
class Float32Array extends TypedArray implements Iterable<number>An array of 32-bit floats (f32) in an ArrayBuffer (JS Float32Array): new Float32Array(n) (n zeros),
new Float32Array([1, 2]) (a copy, converted), new Float32Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 4The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 4), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Float32ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Float32ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Float32Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Float32Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Float32ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Float32ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Float32ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Float32ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Float32ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Float32ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Float32ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Float32Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Float32ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Float32Array(2) [ 1, 2 ].
Re-exported from velt/lang/typed_array/float64_array
class Float64Array extends TypedArray implements Iterable<number>An array of 64-bit floats (numbers) in an ArrayBuffer (JS Float64Array): new Float64Array(n) (n zeros),
new Float64Array([1, 2]) (a copy, converted), new Float64Array(buffer, byteOffset, length) (a view of
buffer, sharing it), or a copy of another typed array.
static readonly BYTES_PER_ELEMENT: number = 8The size of an element in bytes.
constructor(arg: number | ArrayBuffer | number[] | TypedArray = 0, byteOffset: number = 0, length?: number)n zero elements; a copy of an array's or typed array's elements, converted; or a view of
buffer from byteOffset (a multiple of 8), of length elements or up to its end.
RangeError as in JS for a negative length or a range outside the buffer.
[ [TYPED_ARRAY_GET](i: usize): numberNo doc comment yet[ [TYPED_ARRAY_PUT](i: usize, v: number)No doc comment yet[ [TYPED_ARRAY_KIND](): u32No doc comment yet[ [VIEW_EMPTY_TEXT](): stringNo doc comment yet[ [VIEW_SIZE](): usizeNo doc comment yet[ [INDEX](i: number): numberxs[i]: element i; panics out of range, like an array index (JS reads undefined).
[ [SET_INDEX](i: number, v: number)xs[i] = v: writes element i, converted; nothing out of range, as in JS (nor past the
end of a u8[] that became shorter than its subarray: length).
get buffer(): ArrayBufferThe buffer the elements are in.
get byteOffset(): numberWhere the first element is in buffer, in bytes.
get byteLength(): numberThe size of the elements in bytes: length * BYTES_PER_ELEMENT.
get length(): numberThe number of elements.
at(position: number): number | undefinedElement i, counting from the end when negative; undefined out of range.
copyWithin(target: number, start: number = 0, end: number = Infinity): Float64ArrayCopies the elements in [start, end) to position target (overlap is fine); returns this array.
entries(): [number, number][][index, element] pairs (JS returns an iterator).
keys(): number[]The indexes, 0 to length - 1 (JS returns an iterator).
values(): number[]The elements as numbers (JS returns an iterator).
every<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for every element.
some<E>(pred: (x: number, i: number) => bool throws E): bool throws EWhether pred holds for some element.
fill(value: number, start: number = 0, end: number = Infinity): Float64ArraySets the elements in [start, end) to value, converted; returns this array.
filter<E>(keep: (x: number, i: number) => bool throws E): Float64Array throws EA new array of the elements keep holds for.
find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe first element pred holds for, or undefined.
findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the first element pred holds for, or -1.
findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws EThe last element pred holds for, or undefined.
findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws EThe index of the last element pred holds for, or -1.
forEach<E>(f: (x: number, i: number) => void throws E) throws ECalls f with each element and its index.
includes(x: number, from: number = 0): boolWhether an element is x (NaN finds NaN, as JS's includes), from position from.
indexOf(x: number, from: number = 0): numberThe first index at or after from holding x (===: NaN is never found), or -1.
lastIndexOf(x: number, position: number = Infinity): numberThe last index at or before from holding x (===), or -1.
join(sep: string = ","): stringThe elements as text, sep between them (String(x) of each: -0 is 0).
map<E>(f: (x: number, i: number) => number throws E): Float64Array throws EA new array of f's results, converted.
reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the first, starting with init.
reduceRight<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws EFolds the elements from the last, starting with init.
reverse(): Float64ArrayReverses the elements in place; returns this array.
set(src: number[] | TypedArray, offset: number = 0)Writes the elements of src (an array or a typed array of any kind, converted) from
position offset; RangeError when they don't fit. A source sharing this array's buffer
is read before anything is written, as in JS.
slice(start: number = 0, end: number = Infinity): Float64ArrayA new array with a copy of the elements in [start, end) (negative counts from the end).
sort(cmp: ((a: number, b: number) => number) | null = null): Float64ArraySorts the elements in place; returns this array. Numeric order by default (-0 before 0,
NaN last), or cmp's (negative: a first), keeping equal elements in order.
subarray(begin: number = 0, end: number = Infinity): Float64ArrayA view of the elements in [begin, end) (negative counts from the end) sharing this array's buffer: writes through either are seen by both.
toLocaleString(): stringThe elements as Node's default locale (en-US) writes them, joined by ,.
toReversed(): Float64ArrayA reversed copy (ES2023); this array is unchanged.
toSorted(cmp: ((a: number, b: number) => number) | null = null): Float64ArrayA sorted copy (ES2023, the order of sort); this array is unchanged.
toString(): stringThe elements joined by , (what String(xs) and ${xs} give).
with(position: number, value: number): Float64ArrayA copy with element index (negative counts from the end) set to value; RangeError out of range.
* [Symbol.iterator](): Iterator<number>The elements in order: for (const x of xs), [...xs].
static from<E>(src: Iterable<number, E>, map: ((x: number, i: number) => number) | null = null): Float64Array throws EA new array of the elements of src (or map's results for them), converted.
static of(... items: number[] = ): Float64ArrayA new array of items, converted.
toJSON(): Record<string, number>JSON.stringify writes a typed array as an object of its elements, as in JS: {"0":1,"1":2}.
[ [INSPECT](): number[]How console.log shows the array, like Node: Float64Array(2) [ 1, 2 ].