Skip to content

Commit

Permalink
Enforce string is passed to toUtf8Bytes (#4583).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Feb 14, 2024
1 parent 7f0e140 commit f45bb87
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src.ts/utils/utf8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ function getUtf8CodePoints(_bytes: BytesLike, onError?: Utf8ErrorFunc): Array<nu
* If %%form%% is specified, the string is normalized.
*/
export function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array {
assertArgument(typeof(str) === "string", "invalid string value", "str", str);

if (form != null) {
assertNormalize(form);
Expand Down

0 comments on commit f45bb87

Please sign in to comment.