(str)
| 568 | } |
| 569 | |
| 570 | function utf8Length(str){ |
| 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 | } |
| 577 | } |
| 578 | /** |
| 579 | * Light EventEmitter. Ported from Node.js/events.js |
| 580 | * Eric Zhang |