Skip to main content

Interface: FlexBytes<Min, Max>

Utils.FlexBytes

Helper type for dealing with flexible sized byte arrays.

The actual min and and max values are not stored in runtime, they are only there to differentiate the type from the Uint8Array at compile time.

see BrandedType

Type parameters

NameType
Minextends number
Maxextends number

Hierarchy

  • Uint8Array

    FlexBytes

Properties

BYTES_PER_ELEMENT

Readonly BYTES_PER_ELEMENT: number

The size in bytes of each element in the array.

Inherited from

Uint8Array.BYTES_PER_ELEMENT

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2102


[toStringTag]

Readonly [toStringTag]: "Uint8Array"

Inherited from

Uint8Array.__@toStringTag@24

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:282


__max__

Readonly __max__: Max

Defined in

bee-js/src/utils/bytes.ts:25


__min__

Readonly __min__: Min

Defined in

bee-js/src/utils/bytes.ts:24


buffer

Readonly buffer: ArrayBufferLike

The ArrayBuffer instance referenced by the array.

Inherited from

Uint8Array.buffer

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2107


byteLength

Readonly byteLength: number

The length in bytes of the array.

Inherited from

Uint8Array.byteLength

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2112


byteOffset

Readonly byteOffset: number

The offset in bytes of the array.

Inherited from

Uint8Array.byteOffset

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2117


length

Readonly length: number

The length of the array.

Inherited from

Uint8Array.length

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2216

Methods

[iterator]

[iterator](): IterableIterator<number>

Returns

IterableIterator<number>

Inherited from

Uint8Array.__@iterator@81

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:272


copyWithin

copyWithin(target, start, end?): FlexBytes<Min, Max>

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

Parameters

NameTypeDescription
targetnumberIf target is negative, it is treated as length+target where length is the length of the array.
startnumberIf start is negative, it is treated as length+start. If end is negative, it is treated as length+end.
end?numberIf not specified, length of the this object is used as its default value.

Returns

FlexBytes<Min, Max>

Inherited from

Uint8Array.copyWithin

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2128


entries

entries(): IterableIterator<[number, number]>

Returns an array of key, value pairs for every entry in the array

Returns

IterableIterator<[number, number]>

Inherited from

Uint8Array.entries

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:276


every

every(predicate, thisArg?): boolean

Determines whether all the members of an array satisfy the specified test.

Parameters

NameTypeDescription
predicate(value: number, index: number, array: Uint8Array) => unknownA function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.
thisArg?anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Uint8Array.every

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2138


fill

fill(value, start?, end?): FlexBytes<Min, Max>

Changes all array elements from start to end index to a static value and returns the modified array

Parameters

NameTypeDescription
valuenumbervalue to fill array section with
start?numberindex to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.
end?numberindex to stop filling the array at. If end is negative, it is treated as length+end.

Returns

FlexBytes<Min, Max>

Inherited from

Uint8Array.fill

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2148


filter

filter(predicate, thisArg?): Uint8Array

Returns the elements of an array that meet the condition specified in a callback function.

Parameters

NameTypeDescription
predicate(value: number, index: number, array: Uint8Array) => anyA function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
thisArg?anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

Uint8Array

Inherited from

Uint8Array.filter

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2157


find

find(predicate, thisArg?): undefined | number

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

Parameters

NameTypeDescription
predicate(value: number, index: number, obj: Uint8Array) => booleanfind calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.
thisArg?anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

undefined | number

Inherited from

Uint8Array.find

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2168


findIndex

findIndex(predicate, thisArg?): number

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

Parameters

NameTypeDescription
predicate(value: number, index: number, obj: Uint8Array) => booleanfind calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.
thisArg?anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Uint8Array.findIndex

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2179


forEach

forEach(callbackfn, thisArg?): void

Performs the specified action for each element in an array.

Parameters

NameTypeDescription
callbackfn(value: number, index: number, array: Uint8Array) => voidA function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
thisArg?anyAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

void

Inherited from

Uint8Array.forEach

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2188


includes

includes(searchElement, fromIndex?): boolean

Determines whether an array includes a certain element, returning true or false as appropriate.

Parameters

NameTypeDescription
searchElementnumberThe element to search for.
fromIndex?numberThe position in this array at which to begin searching for searchElement.

Returns

boolean

Inherited from

Uint8Array.includes

Defined in

node_modules/typescript/lib/lib.es2016.array.include.d.ts:54


indexOf

indexOf(searchElement, fromIndex?): number

Returns the index of the first occurrence of a value in an array.

Parameters

NameTypeDescription
searchElementnumberThe value to locate in the array.
fromIndex?numberThe array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

Returns

number

Inherited from

Uint8Array.indexOf

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2196


join

join(separator?): string

Adds all the elements of an array separated by the specified separator string.

Parameters

NameTypeDescription
separator?stringA string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

Returns

string

Inherited from

Uint8Array.join

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2203


keys

keys(): IterableIterator<number>

Returns an list of keys in the array

Returns

IterableIterator<number>

Inherited from

Uint8Array.keys

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:280


lastIndexOf

lastIndexOf(searchElement, fromIndex?): number

Returns the index of the last occurrence of a value in an array.

Parameters

NameTypeDescription
searchElementnumberThe value to locate in the array.
fromIndex?numberThe array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

Returns

number

Inherited from

Uint8Array.lastIndexOf

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2211


map

map(callbackfn, thisArg?): Uint8Array

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Parameters

NameTypeDescription
callbackfn(value: number, index: number, array: Uint8Array) => numberA function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
thisArg?anyAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

Uint8Array

Inherited from

Uint8Array.map

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2226


reduce

reduce(callbackfn): number

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters

NameTypeDescription
callbackfn(previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => numberA function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

Returns

number

Inherited from

Uint8Array.reduce

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2238

reduce(callbackfn, initialValue): number

Parameters

NameType
callbackfn(previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number
initialValuenumber

Returns

number

Inherited from

Uint8Array.reduce

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2239

reduce<U>(callbackfn, initialValue): U

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type parameters

Name
U

Parameters

NameTypeDescription
callbackfn(previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => UA function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
initialValueUIf initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Uint8Array.reduce

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2251


reduceRight

reduceRight(callbackfn): number

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters

NameTypeDescription
callbackfn(previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => numberA function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

Returns

number

Inherited from

Uint8Array.reduceRight

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2263

reduceRight(callbackfn, initialValue): number

Parameters

NameType
callbackfn(previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number
initialValuenumber

Returns

number

Inherited from

Uint8Array.reduceRight

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2264

reduceRight<U>(callbackfn, initialValue): U

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type parameters

Name
U

Parameters

NameTypeDescription
callbackfn(previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => UA function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
initialValueUIf initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Uint8Array.reduceRight

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2276


reverse

reverse(): Uint8Array

Reverses the elements in an Array.

Returns

Uint8Array

Inherited from

Uint8Array.reverse

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2281


set

set(array, offset?): void

Sets a value or an array of values.

Parameters

NameTypeDescription
arrayArrayLike<number>A typed or untyped array of values to set.
offset?numberThe index in the current array at which the values are to be written.

Returns

void

Inherited from

Uint8Array.set

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2288


slice

slice(start?, end?): Uint8Array

Returns a section of an array.

Parameters

NameTypeDescription
start?numberThe beginning of the specified portion of the array.
end?numberThe end of the specified portion of the array. This is exclusive of the element at the index 'end'.

Returns

Uint8Array

Inherited from

Uint8Array.slice

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2295


some

some(predicate, thisArg?): boolean

Determines whether the specified callback function returns true for any element of an array.

Parameters

NameTypeDescription
predicate(value: number, index: number, array: Uint8Array) => unknownA function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.
thisArg?anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Uint8Array.some

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2305


sort

sort(compareFn?): FlexBytes<Min, Max>

Sorts an array.

Parameters

NameTypeDescription
compareFn?(a: number, b: number) => numberFunction used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending order. ts [11,2,22,1].sort((a, b) => a - b)

Returns

FlexBytes<Min, Max>

Inherited from

Uint8Array.sort

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2316


subarray

subarray(begin?, end?): Uint8Array

Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.

Parameters

NameTypeDescription
begin?numberThe index of the beginning of the array.
end?numberThe index of the end of the array.

Returns

Uint8Array

Inherited from

Uint8Array.subarray

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2324


toLocaleString

toLocaleString(): string

Converts a number to a string by using the current locale.

Returns

string

Inherited from

Uint8Array.toLocaleString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2329


toString

toString(): string

Returns a string representation of an array.

Returns

string

Inherited from

Uint8Array.toString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2334


valueOf

valueOf(): Uint8Array

Returns the primitive value of the specified object.

Returns

Uint8Array

Inherited from

Uint8Array.valueOf

Defined in

node_modules/typescript/lib/lib.es5.d.ts:2337


values

values(): IterableIterator<number>

Returns an list of values in the array

Returns

IterableIterator<number>

Inherited from

Uint8Array.values

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:284