16
16
17
17
import * as Core from "@litert/core" ;
18
18
19
- const Errors = Core . getDefaultErrorHub ( ) ;
19
+ /**
20
+ * The error hub of encodings module.
21
+ */
22
+ export const Errors = Core . createErrorHub ( "@litert/encodings" ) ;
20
23
21
24
/**
22
25
* E_INVALID_ENCODING
@@ -61,11 +64,11 @@ export function getEncodings(): Encodings[] {
61
64
}
62
65
63
66
/**
64
- * Convert a string from BASE64 to BASE64-URL-Escaped encoding.
67
+ * Convert a string from BASE64 to BASE64-URL-Safe encoding.
65
68
*
66
69
* @param {string } base64 The BASE64 encoding string to be converted.
67
70
*
68
- * @returns {string } returns the BASE64-URL-Escaped encoding result of input.
71
+ * @returns {string } returns the BASE64-URL-Safe encoding result of input.
69
72
*/
70
73
export function base64UrlEncode ( base64 : string ) : string {
71
74
@@ -76,16 +79,16 @@ export function base64UrlEncode(base64: string): string {
76
79
}
77
80
78
81
/**
79
- * Convert a string to Strict-URL-Escaped encoding.
82
+ * Convert a string to Strict-URL-Safe encoding.
80
83
*
81
84
* > All special chars including `-`, `.`, `_`, `!`, `*`, `(`, `)`, `~`, `'`
82
85
* > will be escaped.
83
86
*
84
- * NOTE: Decode the Strict-URL-Escaped encoding string by `decodeURIComponent`.
87
+ * NOTE: Decode the Strict-URL-Safe encoding string by `decodeURIComponent`.
85
88
*
86
89
* @param {string } text The string to be converted.
87
90
*
88
- * @returns {string } returns the Strict-URL-Escaped encoding result of input.
91
+ * @returns {string } returns the Strict-URL-Safe encoding result of input.
89
92
*/
90
93
export function encodeURIStrictly ( text : string ) : string {
91
94
@@ -100,9 +103,9 @@ function _encodeURIStrictly(text: string): string {
100
103
}
101
104
102
105
/**
103
- * Convert a string from BASE64-URL-Escaped encoding to BASE64.
106
+ * Convert a string from BASE64-URL-Safe encoding to BASE64.
104
107
*
105
- * @param {string } base64 The BASE64-URL-Escaped encoding string to be converted.
108
+ * @param {string } base64 The BASE64-URL-Safe encoding string to be converted.
106
109
*
107
110
* @returns {string } returns the BASE64 encoding result of input.
108
111
*/
0 commit comments