Skip to content

Commit 29087e0

Browse files
committed
Merge
1 parent efdc761 commit 29087e0

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

dist/binarypack.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,12 @@ function _utf8Replace(m){
568568
}
569569

570570
function utf8Length(str){
571-
return str.replace(/[^\u0000-\u007F]/g, _utf8Replace).length;
571+
if (str.length > 600) {
572+
// Blob method faster for large strings
573+
return (new Blob([str])).size;
574+
} else {
575+
return str.replace(/[^\u0000-\u007F]/g, _utf8Replace).length;
576+
}
572577
}
573578

574579
})(this);

dist/binarypack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)