ReadonlyUint8Array
A read-only variant of Uint8Array
.
This type prevents modifications to the array by omitting mutable methods such as copyWithin
,
fill
, reverse
, set
, and sort
, while still allowing indexed access to elements.
Example
Extends
Omit
<Uint8Array
,TypedArrayMutableProperties
>
Indexable
[n
: number
]: number
Properties
Methods
[iterator]()
[iterator]():
ArrayIterator
<number
>
Returns
ArrayIterator
<number
>
Inherited from
Omit.[iterator]
entries()
entries():
ArrayIterator
<[number
,number
]>
Returns an array of key, value pairs for every entry in the array
Returns
ArrayIterator
<[number
, number
]>
Inherited from
Omit.entries
every()
every(
predicate
,thisArg?
):boolean
Determines whether all the members of an array satisfy the specified test.
Parameters
Parameter | Type | Description |
---|---|---|
predicate | (value , index , array ) => unknown | A 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? | any | An 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
Omit.every
filter()
filter(
predicate
,thisArg?
):Uint8Array
<ArrayBuffer
>
Returns the elements of an array that meet the condition specified in a callback function.
Parameters
Parameter | Type | Description |
---|---|---|
predicate | (value , index , array ) => any | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. |
thisArg? | any | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. |
Returns
Inherited from
Omit.filter
find()
find(
predicate
,thisArg?
):undefined
|number
Returns the value of the first element in the array where predicate is true, and undefined otherwise.
Parameters
Parameter | Type | Description |
---|---|---|
predicate | (value , index , obj ) => boolean | find 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? | any | If 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
Omit.find
findIndex()
findIndex(
predicate
,thisArg?
):number
Returns the index of the first element in the array where predicate is true, and -1 otherwise.
Parameters
Parameter | Type | Description |
---|---|---|
predicate | (value , index , obj ) => boolean | find 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? | any | If 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
Omit.findIndex
forEach()
forEach(
callbackfn
,thisArg?
):void
Performs the specified action for each element in an array.
Parameters
Parameter | Type | Description |
---|---|---|
callbackfn | (value , index , array ) => void | A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. |
thisArg? | any | An 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
Omit.forEach
includes()
includes(
searchElement
,fromIndex?
):boolean
Determines whether an array includes a certain element, returning true or false as appropriate.
Parameters
Parameter | Type | Description |
---|---|---|
searchElement | number | The element to search for. |
fromIndex? | number | The position in this array at which to begin searching for searchElement. |
Returns
boolean
Inherited from
Omit.includes
indexOf()
indexOf(
searchElement
,fromIndex?
):number
Returns the index of the first occurrence of a value in an array.
Parameters
Parameter | Type | Description |
---|---|---|
searchElement | number | The value to locate in the array. |
fromIndex? | number | The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. |
Returns
number
Inherited from
Omit.indexOf
join()
join(
separator?
):string
Adds all the elements of an array separated by the specified separator string.
Parameters
Parameter | Type | Description |
---|---|---|
separator? | string | A 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
Omit.join
keys()
keys():
ArrayIterator
<number
>
Returns an list of keys in the array
Returns
ArrayIterator
<number
>
Inherited from
Omit.keys
lastIndexOf()
lastIndexOf(
searchElement
,fromIndex?
):number
Returns the index of the last occurrence of a value in an array.
Parameters
Parameter | Type | Description |
---|---|---|
searchElement | number | The value to locate in the array. |
fromIndex? | number | The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. |
Returns
number
Inherited from
Omit.lastIndexOf
map()
map(
callbackfn
,thisArg?
):Uint8Array
<ArrayBuffer
>
Calls a defined callback function on each element of an array, and returns an array that contains the results.
Parameters
Parameter | Type | Description |
---|---|---|
callbackfn | (value , index , array ) => number | A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. |
thisArg? | any | An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
Returns
Inherited from
Omit.map
reduce()
Call Signature
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
Parameter | Type | Description |
---|---|---|
callbackfn | (previousValue , currentValue , currentIndex , array ) => number | A 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
Omit.reduce
Call Signature
reduce(
callbackfn
,initialValue
):number
Parameters
Parameter | Type |
---|---|
callbackfn | (previousValue , currentValue , currentIndex , array ) => number |
initialValue | number |
Returns
number
Inherited from
Omit.reduce
Call Signature
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
Type Parameter |
---|
U |
Parameters
Parameter | Type | Description |
---|---|---|
callbackfn | (previousValue , currentValue , currentIndex , array ) => U | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. |
initialValue | U | If 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
Omit.reduce
reduceRight()
Call Signature
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
Parameter | Type | Description |
---|---|---|
callbackfn | (previousValue , currentValue , currentIndex , array ) => number | A 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
Omit.reduceRight
Call Signature
reduceRight(
callbackfn
,initialValue
):number
Parameters
Parameter | Type |
---|---|
callbackfn | (previousValue , currentValue , currentIndex , array ) => number |
initialValue | number |
Returns
number
Inherited from
Omit.reduceRight
Call Signature
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
Type Parameter |
---|
U |
Parameters
Parameter | Type | Description |
---|---|---|
callbackfn | (previousValue , currentValue , currentIndex , array ) => U | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. |
initialValue | U | If 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
Omit.reduceRight
slice()
slice(
start?
,end?
):Uint8Array
<ArrayBuffer
>
Returns a section of an array.
Parameters
Parameter | Type | Description |
---|---|---|
start? | number | The beginning of the specified portion of the array. |
end? | number | The end of the specified portion of the array. This is exclusive of the element at the index 'end'. |
Returns
Inherited from
Omit.slice
some()
some(
predicate
,thisArg?
):boolean
Determines whether the specified callback function returns true for any element of an array.
Parameters
Parameter | Type | Description |
---|---|---|
predicate | (value , index , array ) => unknown | A 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? | any | An 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
Omit.some
subarray()
subarray(
begin?
,end?
):Uint8Array
<ArrayBufferLike
>
Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.
Parameters
Parameter | Type | Description |
---|---|---|
begin? | number | The index of the beginning of the array. |
end? | number | The index of the end of the array. |
Returns
Uint8Array
<ArrayBufferLike
>
Inherited from
Omit.subarray
toLocaleString()
Call Signature
toLocaleString():
string
Converts a number to a string by using the current locale.
Returns
string
Inherited from
Omit.toLocaleString
Call Signature
toLocaleString(
locales
,options?
):string
Parameters
Parameter | Type |
---|---|
locales | string | string [] |
options? | NumberFormatOptions |
Returns
string
Inherited from
Omit.toLocaleString
toString()
toString():
string
Returns a string representation of an array.
Returns
string
Inherited from
Omit.toString
valueOf()
valueOf():
this
Returns the primitive value of the specified object.
Returns
this
Inherited from
Omit.valueOf
values()
values():
ArrayIterator
<number
>
Returns an list of values in the array
Returns
ArrayIterator
<number
>
Inherited from
Omit.values