File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -225,11 +225,11 @@ export class BN {
225225 return native . toArray . call ( this . internalBigNum , endian === 'le' , len || - 1 ) ;
226226 }
227227
228- // TODO(MARC ts magician )
228+ // TODO(MARC ts magician - please check )
229229 toArrayLike < T extends ( len : number ) => { buffer : ArrayBuffer } > (
230230 arrayLike : T ,
231- endian : 'le' | 'be' ,
232- len : number
231+ endian ? : 'le' | 'be' ,
232+ len ? : number
233233 ) {
234234 if ( typeof arrayLike !== 'function' ) {
235235 console . log ( 'toArrayLike exptects constructor' ) ;
@@ -240,7 +240,9 @@ export class BN {
240240 return this . toArray ( endian , len ) ;
241241 }
242242
243- const res = new ( arrayLike as any ) ( len ) ;
243+ const outLen = len != null ? len : this . byteLength ( ) ;
244+
245+ const res = new ( arrayLike as any ) ( outLen ) ;
244246
245247 native . toArrayLike . call (
246248 this . internalBigNum ,
You can’t perform that action at this time.
0 commit comments