@types/utf8
Version:
TypeScript definitions for utf8
20 lines (17 loc) • 663 B
TypeScript
export as namespace utf8;
/**
* A string representing the semantic version number.
*/
export const version: string;
/**
* Encodes any given JavaScript string (string) as UTF-8, and returns the UTF-8-encoded version of the string.
* It throws an error if the input string contains a non-scalar value, i.e. a lone surrogate.
* @param inputString
*/
export function encode(inputString: string): string;
/**
* Decodes any given UTF-8-encoded string (byteString) as UTF-8, and returns the UTF-8-decoded version of the string.
* It throws an error when malformed UTF-8 is detected.
* @param byteString
*/
export function decode(byteString: string): string;