Skip to content
prelude/typed_array exports

prelude/typed_array

API reference

ArrayBuffer, 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.

// Globals: in scope everywhere, no import.

Exports

ArrayBufferA fixed-length block of bytes (JS 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.

constructor(byteLength: number = 0)

byteLength zero bytes (RangeError for a negative or non-integer length beyond 2^53).

get byteLength(): number

The number of bytes.

get resizable(): bool

The length cannot change (JS: false unless made with maxByteLength).

get maxByteLength(): number

The most bytes it can hold: its byteLength, since it is not resizable.

get detached(): bool

Whether the buffer was transferred away (never: Velt has no transfer yet).

slice(begin: number = 0, end: number = Infinity): ArrayBuffer

A 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 ArrayBufferView

Whether 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](): NativeInspect

How 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 BufferView

A 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(): ArrayBuffer

The buffer the view is of.

get byteOffset(): number

Where the view starts in buffer, in bytes.

get byteLength(): number

The size of the view in bytes.

getInt8(byteOffset: number): number

The signed byte at byteOffset.

getUint8(byteOffset: number): number

The byte at byteOffset.

getInt16(byteOffset: number, littleEndian: bool = false): number

The 16-bit signed integer at byteOffset.

getUint16(byteOffset: number, littleEndian: bool = false): number

The 16-bit unsigned integer at byteOffset.

getInt32(byteOffset: number, littleEndian: bool = false): number

The 32-bit signed integer at byteOffset.

getUint32(byteOffset: number, littleEndian: bool = false): number

The 32-bit unsigned integer at byteOffset.

getFloat32(byteOffset: number, littleEndian: bool = false): number

The 32-bit float at byteOffset.

getFloat64(byteOffset: number, littleEndian: bool = false): number

The 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 yet
toString(): string

"[object DataView]", as String(view) gives in JS.

toJSON(): Record<string, number>

JSON.stringify writes a DataView as {}, as in JS.

[ [INSPECT](): NativeInspect

How 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 = 1

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Int8Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Int8Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Int8Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Int8Array

Reverses 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): Int8Array

A 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): Int8Array

Sorts 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): Int8Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Int8Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Int8Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Int8Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Int8Array

A 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.

static readonly BYTES_PER_ELEMENT: number = 1

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Uint8Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Uint8Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Uint8Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Uint8Array

Reverses 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): Uint8Array

A 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): Uint8Array

Sorts 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): Uint8Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Uint8Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint8Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Uint8Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Uint8Array

A 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[]): Uint8Array

A 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 = 1

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Uint8ClampedArray

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Uint8ClampedArray

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Uint8ClampedArray throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Uint8ClampedArray

Reverses 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): Uint8ClampedArray

A 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): Uint8ClampedArray

Sorts 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): Uint8ClampedArray

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Uint8ClampedArray

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint8ClampedArray

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Uint8ClampedArray

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Uint8ClampedArray

A 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 = 2

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Int16Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Int16Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Int16Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Int16Array

Reverses 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): Int16Array

A 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): Int16Array

Sorts 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): Int16Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Int16Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Int16Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Int16Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Int16Array

A 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 = 2

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Uint16Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Uint16Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Uint16Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Uint16Array

Reverses 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): Uint16Array

A 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): Uint16Array

Sorts 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): Uint16Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Uint16Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint16Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Uint16Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Uint16Array

A 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 = 4

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Int32Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Int32Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Int32Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Int32Array

Reverses 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): Int32Array

A 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): Int32Array

Sorts 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): Int32Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Int32Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Int32Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Int32Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Int32Array

A 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 = 4

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Uint32Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Uint32Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Uint32Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Uint32Array

Reverses 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): Uint32Array

A 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): Uint32Array

Sorts 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): Uint32Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Uint32Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Uint32Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Uint32Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Uint32Array

A 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 = 4

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Float32Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Float32Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Float32Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Float32Array

Reverses 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): Float32Array

A 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): Float32Array

Sorts 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): Float32Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Float32Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Float32Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Float32Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Float32Array

A 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 = 8

The 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): number

xs[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(): ArrayBuffer

The buffer the elements are in.

get byteOffset(): number

Where the first element is in buffer, in bytes.

get byteLength(): number

The size of the elements in bytes: length * BYTES_PER_ELEMENT.

get length(): number

The number of elements.

at(position: number): number | undefined

Element i, counting from the end when negative; undefined out of range.

copyWithin(target: number, start: number = 0, end: number = Infinity): Float64Array

Copies 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 E

Whether pred holds for every element.

some<E>(pred: (x: number, i: number) => bool throws E): bool throws E

Whether pred holds for some element.

fill(value: number, start: number = 0, end: number = Infinity): Float64Array

Sets the elements in [start, end) to value, converted; returns this array.

filter<E>(keep: (x: number, i: number) => bool throws E): Float64Array throws E

A new array of the elements keep holds for.

find<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The first element pred holds for, or undefined.

findIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the first element pred holds for, or -1.

findLast<E>(pred: (x: number, i: number) => bool throws E): number | undefined throws E

The last element pred holds for, or undefined.

findLastIndex<E>(pred: (x: number, i: number) => bool throws E): number throws E

The index of the last element pred holds for, or -1.

forEach<E>(f: (x: number, i: number) => void throws E) throws E

Calls f with each element and its index.

includes(x: number, from: number = 0): bool

Whether an element is x (NaN finds NaN, as JS's includes), from position from.

indexOf(x: number, from: number = 0): number

The first index at or after from holding x (===: NaN is never found), or -1.

lastIndexOf(x: number, position: number = Infinity): number

The last index at or before from holding x (===), or -1.

join(sep: string = ","): string

The 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 E

A new array of f's results, converted.

reduce<A, E>(f: (acc: A, x: number, i: number) => A throws E, init: A): A throws E

Folds 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 E

Folds the elements from the last, starting with init.

reverse(): Float64Array

Reverses 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): Float64Array

A 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): Float64Array

Sorts 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): Float64Array

A 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(): string

The elements as Node's default locale (en-US) writes them, joined by ,.

toReversed(): Float64Array

A reversed copy (ES2023); this array is unchanged.

toSorted(cmp: ((a: number, b: number) => number) | null = null): Float64Array

A sorted copy (ES2023, the order of sort); this array is unchanged.

toString(): string

The elements joined by , (what String(xs) and ${xs} give).

with(position: number, value: number): Float64Array

A 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 E

A new array of the elements of src (or map's results for them), converted.

static of(... items: number[] = ): Float64Array

A 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 ].