ethers.js/packages/strings/lib.esm/utf8.d.ts

27 lines
1.2 KiB
TypeScript
Raw Permalink Normal View History

2019-07-27 19:02:24 -03:00
import { BytesLike } from "@ethersproject/bytes";
export declare enum UnicodeNormalizationForm {
current = "",
NFC = "NFC",
NFD = "NFD",
NFKC = "NFKC",
NFKD = "NFKD"
}
2020-01-20 19:43:50 -05:00
export declare enum Utf8ErrorReason {
UNEXPECTED_CONTINUE = "unexpected continuation byte",
BAD_PREFIX = "bad codepoint prefix",
OVERRUN = "string overrun",
MISSING_CONTINUE = "missing continuation byte",
OUT_OF_RANGE = "out of UTF-8 range",
UTF16_SURROGATE = "UTF-16 surrogate",
OVERLONG = "overlong representation"
}
export declare type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number) => number;
export declare const Utf8ErrorFuncs: {
[name: string]: Utf8ErrorFunc;
};
2019-07-27 19:02:24 -03:00
export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array;
2020-01-20 19:43:50 -05:00
export declare function _toEscapedUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
2019-08-02 02:10:58 -04:00
export declare function _toUtf8String(codePoints: Array<number>): string;
2020-01-20 19:43:50 -05:00
export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
2019-07-27 19:02:24 -03:00
export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array<number>;
//# sourceMappingURL=utf8.d.ts.map