jsStrndup function
Implementation
String jsStrndup(JSContext ctx, String str, int n) {
final ret = js_strndup(ctx.ref, str.toNativeUtf8(), n);
return String.fromCharCodes(
Uint16List.view(
ret.cast<Uint16>().asTypedList(str.length).buffer,
0,
str.length,
),
);
}