denoland/std

Clean up `encoding` module, part 2

Closed this issue · 2 comments

kt3k commented

encoding module has the following encodings and corresponding decode and encode methods:

  • ascii85
    • encode: Uint8Array -> string
    • decode: string -> Uint8Array
  • base32
    • encode: Uint8Array -> string
    • decode: string -> Uint8Array
  • base58
    • encode: ArrayBuffer | string -> string
    • decode: string -> Uint8Array
  • base64
    • encode: ArrayBuffer | string -> string
    • decode: string -> Uint8Array
  • base64url
    • encode: ArrayBuffer | string -> string
    • decode: string -> Uint8Array
  • hex
    • encode: Uint8Array -> Uint8Array
    • decode: Uint8Array -> Uint8Array
  • varint
    • encode: bigint | number -> [Uint8Array, number]
    • decode: Uint8Array -> [bigint, number]

Encodings except varint are similar in typing, but there are discrepancies (The case of hex is pointed in #3605). I think these 6 encodings should have the same typings, for example encode: Uint8Array | ArrayBuffer | string -> string; decode: string -> Uint8Array

part of #3489

@kt3k is this completed?

kt3k commented

@lino-levan Yeah, let's close this. Thanks for your contributions!