Skip to content

Commit f45bb87

Browse files
committed
Enforce string is passed to toUtf8Bytes (#4583).
1 parent 7f0e140 commit f45bb87

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src.ts/utils/utf8.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ function getUtf8CodePoints(_bytes: BytesLike, onError?: Utf8ErrorFunc): Array<nu
247247
* If %%form%% is specified, the string is normalized.
248248
*/
249249
export function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array {
250+
assertArgument(typeof(str) === "string", "invalid string value", "str", str);
250251

251252
if (form != null) {
252253
assertNormalize(form);

0 commit comments

Comments
 (0)