An alternative to stringify that produces valid JavaScript for use
as a test vector in this library. Uint8Arrays are constructed using
hexToBin and bigint values use the BigInt constructor. If
alphabetize is true, all objects will be sorted in the output.
Note, this assumes all strings that match the expected regular expressions
are values of type Uint8Array and bigint respectively. String values
that otherwise happen to match these regular expressions will be converted
incorrectly.
Parameters
value: any
the value to stringify
alphabetize: boolean = true
whether or not to alphabetize object keys, defaults
to true
An alternative to stringify that produces valid JavaScript for use as a test vector in this library.
Uint8Array
s are constructed using hexToBin andbigint
values use theBigInt
constructor. Ifalphabetize
istrue
, all objects will be sorted in the output.Note, this assumes all strings that match the expected regular expressions are values of type
Uint8Array
andbigint
respectively. String values that otherwise happen to match these regular expressions will be converted incorrectly.