@@ -11,7 +11,7 @@ import {InvalidArgumentsException} from './exception/invalid_arguments_exception
1111 * @param ba2 - The second bytearray to check.
1212 * @returns If the array are equal.
1313 */
14- export function isEqual ( ba1 : Uint8Array , ba2 : Uint8Array ) : boolean {
14+ export function isEqual ( ba1 : Uint8Array < ArrayBuffer > , ba2 : Uint8Array < ArrayBuffer > ) : boolean {
1515 if ( ba1 . length !== ba2 . length ) {
1616 return false ;
1717 }
@@ -25,7 +25,7 @@ export function isEqual(ba1: Uint8Array, ba2: Uint8Array): boolean {
2525/**
2626 * Returns a new array that is the result of joining the arguments.
2727 */
28- export function concat ( ...var_args : Uint8Array [ ] ) : Uint8Array {
28+ export function concat ( ...var_args : Uint8Array < ArrayBuffer > [ ] ) : Uint8Array < ArrayBuffer > {
2929 let length = 0 ;
3030 for ( let i = 0 ; i < arguments . length ; i ++ ) {
3131 // eslint-disable-next-line prefer-rest-params
@@ -48,7 +48,7 @@ export function concat(...var_args: Uint8Array[]): Uint8Array {
4848 * @returns The number as a big-endian byte array.
4949 * @throws {@link InvalidArgumentsException }
5050 */
51- export function fromNumber ( value : number ) : Uint8Array {
51+ export function fromNumber ( value : number ) : Uint8Array < ArrayBuffer > {
5252 if ( Number . isNaN ( value ) || value % 1 !== 0 ) {
5353 throw new InvalidArgumentsException ( 'cannot convert non-integer value' ) ;
5454 }
@@ -81,7 +81,7 @@ export function fromNumber(value: number): Uint8Array {
8181 * @returns the byte array output
8282 * @throws {@link InvalidArgumentsException }
8383 */
84- export function fromHex ( hex : string ) : Uint8Array {
84+ export function fromHex ( hex : string ) : Uint8Array < ArrayBuffer > {
8585 if ( hex . length % 2 != 0 ) {
8686 throw new InvalidArgumentsException (
8787 'Hex string length must be multiple of 2' ) ;
@@ -99,7 +99,7 @@ export function fromHex(hex: string): Uint8Array {
9999 * @param bytes - the byte array input
100100 * @returns hex the output
101101 */
102- export function toHex ( bytes : Uint8Array ) : string {
102+ export function toHex ( bytes : Uint8Array < ArrayBuffer > ) : string {
103103 let result = '' ;
104104 for ( let i = 0 ; i < bytes . length ; i ++ ) {
105105 const hexByte = bytes [ i ] . toString ( 16 ) ;
@@ -116,7 +116,7 @@ export function toHex(bytes: Uint8Array): string {
116116 * alphabet, which does not require escaping for use in URLs.
117117 * @returns the byte array output
118118 */
119- export function fromBase64 ( encoded : string , opt_webSafe ?: boolean ) : Uint8Array {
119+ export function fromBase64 ( encoded : string , opt_webSafe ?: boolean ) : Uint8Array < ArrayBuffer > {
120120 if ( opt_webSafe ) {
121121 const normalBase64 = encoded . replace ( / - / g, '+' ) . replace ( / _ / g, '/' ) ;
122122 return fromByteString ( window . atob ( normalBase64 ) ) ;
@@ -132,7 +132,7 @@ export function fromBase64(encoded: string, opt_webSafe?: boolean): Uint8Array {
132132 * alphabet, which does not require escaping for use in URLs.
133133 * @returns base64 output
134134 */
135- export function toBase64 ( bytes : Uint8Array , opt_webSafe ?: boolean ) : string {
135+ export function toBase64 ( bytes : Uint8Array < ArrayBuffer > , opt_webSafe ?: boolean ) : string {
136136 const encoded = window
137137 . btoa (
138138 /* padding */
@@ -151,7 +151,7 @@ export function toBase64(bytes: Uint8Array, opt_webSafe?: boolean): string {
151151 * @param str - the input
152152 * @returns the byte array output
153153 */
154- export function fromByteString ( str : string ) : Uint8Array {
154+ export function fromByteString ( str : string ) : Uint8Array < ArrayBuffer > {
155155 const output = [ ] ;
156156 let p = 0 ;
157157 for ( let i = 0 ; i < str . length ; i ++ ) {
@@ -170,7 +170,7 @@ export function fromByteString(str: string): Uint8Array {
170170 * characters.
171171 * @returns Stringification of the array.
172172 */
173- export function toByteString ( bytes : Uint8Array ) : string {
173+ export function toByteString ( bytes : Uint8Array < ArrayBuffer > ) : string {
174174 let str = '' ;
175175 for ( let i = 0 ; i < bytes . length ; i += 1 ) {
176176 str += String . fromCharCode ( bytes [ i ] ) ;
0 commit comments