From 920c0b35153cd8058165125ba0af228416835e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20Ermi=C5=9F?= Date: Sat, 3 Oct 2020 17:44:08 +0300 Subject: docs(std/encoding): add missing JSDoc (#7809) --- std/encoding/hex.ts | 5 +++++ std/encoding/toml.ts | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'std') diff --git a/std/encoding/hex.ts b/std/encoding/hex.ts index 5b09422a9..20d42f657 100644 --- a/std/encoding/hex.ts +++ b/std/encoding/hex.ts @@ -7,6 +7,10 @@ const hextable = new TextEncoder().encode("0123456789abcdef"); +/** + * ErrInvalidByte takes an invalid byte and returns an Error. + * @param byte + */ export function errInvalidByte(byte: number): Error { return new Error( "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 { return new Error("encoding/hex: odd length hex string"); } diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts index 62acc7db7..86ee0bdeb 100644 --- a/std/encoding/toml.ts +++ b/std/encoding/toml.ts @@ -636,10 +636,18 @@ class Dumper { } } +/** + * Stringify dumps source object into TOML string and returns it. + * @param srcObj + */ export function stringify(srcObj: Record): string { return new Dumper(srcObj).dump().join("\n"); } +/** + * Parse parses TOML string into an object. + * @param tomlString + */ export function parse(tomlString: string): Record { // File is potentially using EOL CRLF tomlString = tomlString.replace(/\r\n/g, "\n").replace(/\\\n/g, "\n"); -- cgit v1.2.3