Enforce string is passed to toUtf8Bytes (#4583).
This commit is contained in:
parent
7f0e140d5e
commit
f45bb87aef
@ -247,6 +247,7 @@ function getUtf8CodePoints(_bytes: BytesLike, onError?: Utf8ErrorFunc): Array<nu
|
|||||||
* If %%form%% is specified, the string is normalized.
|
* If %%form%% is specified, the string is normalized.
|
||||||
*/
|
*/
|
||||||
export function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array {
|
export function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array {
|
||||||
|
assertArgument(typeof(str) === "string", "invalid string value", "str", str);
|
||||||
|
|
||||||
if (form != null) {
|
if (form != null) {
|
||||||
assertNormalize(form);
|
assertNormalize(form);
|
||||||
|
Loading…
Reference in New Issue
Block a user