mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
docs(std/encoding): add missing JSDoc (#7809)
This commit is contained in:
parent
f9973364dd
commit
920c0b3515
2 changed files with 13 additions and 0 deletions
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
const hextable = new TextEncoder().encode("0123456789abcdef");
|
const hextable = new TextEncoder().encode("0123456789abcdef");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ErrInvalidByte takes an invalid byte and returns an Error.
|
||||||
|
* @param byte
|
||||||
|
*/
|
||||||
export function errInvalidByte(byte: number): Error {
|
export function errInvalidByte(byte: number): Error {
|
||||||
return new Error(
|
return new Error(
|
||||||
"encoding/hex: invalid byte: " +
|
"encoding/hex: invalid byte: " +
|
||||||
|
@ -14,6 +18,7 @@ export function errInvalidByte(byte: number): Error {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ErrLength returns an error about odd string length. */
|
||||||
export function errLength(): Error {
|
export function errLength(): Error {
|
||||||
return new Error("encoding/hex: odd length hex string");
|
return new Error("encoding/hex: odd length hex string");
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,10 +636,18 @@ class Dumper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stringify dumps source object into TOML string and returns it.
|
||||||
|
* @param srcObj
|
||||||
|
*/
|
||||||
export function stringify(srcObj: Record<string, unknown>): string {
|
export function stringify(srcObj: Record<string, unknown>): string {
|
||||||
return new Dumper(srcObj).dump().join("\n");
|
return new Dumper(srcObj).dump().join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse parses TOML string into an object.
|
||||||
|
* @param tomlString
|
||||||
|
*/
|
||||||
export function parse(tomlString: string): Record<string, unknown> {
|
export function parse(tomlString: string): Record<string, unknown> {
|
||||||
// File is potentially using EOL CRLF
|
// File is potentially using EOL CRLF
|
||||||
tomlString = tomlString.replace(/\r\n/g, "\n").replace(/\\\n/g, "\n");
|
tomlString = tomlString.replace(/\r\n/g, "\n").replace(/\\\n/g, "\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue