Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/binaryjs/js-binarypack
/ utf8Length
Function
utf8Length
lib/binarypack.js:512–519 ·
view source on GitHub ↗
(str)
Source
from the content-addressed store, hash-verified
510
}
511
512
function
utf8Length(str){
513
if
(str.length > 600) {
514
// Blob method faster for large strings
515
return
(
new
Blob([str])).size;
516
}
else
{
517
return
str.replace(/[^\u0000-\u007F]/g, _utf8Replace).length;
518
}
519
}
Callers
1
binarypack.js
File · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected