(encoding, start, end)
| 549 | Buffer.byteLength = byteLength |
| 550 | |
| 551 | function slowToString (encoding, start, end) { |
| 552 | var loweredCase = false |
| 553 | |
| 554 | // No need to verify that "this.length <= MAX_UINT32" since it's a read-only |
| 555 | // property of a typed array. |
| 556 | |
| 557 | // This behaves neither like String nor Uint8Array in that we set start/end |
| 558 | // to their upper/lower bounds if the value passed is out of range. |
| 559 | // undefined is handled specially as per ECMA-262 6th Edition, |
| 560 | // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. |
| 561 | if (start === undefined || start < 0) { |
| 562 | start = 0 |
| 563 | } |
| 564 | // Return early if start > this.length. Done here to prevent potential uint32 |
| 565 | // coercion fail below. |
| 566 | if (start > this.length) { |
| 567 | return '' |
| 568 | } |
| 569 | |
| 570 | if (end === undefined || end > this.length) { |
| 571 | end = this.length |
| 572 | } |
| 573 | |
| 574 | if (end <= 0) { |
| 575 | return '' |
| 576 | } |
| 577 | |
| 578 | // Force coersion to uint32. This will also coerce falsey/NaN values to 0. |
| 579 | end >>>= 0 |
| 580 | start >>>= 0 |
| 581 | |
| 582 | if (end <= start) { |
| 583 | return '' |
| 584 | } |
| 585 | |
| 586 | if (!encoding) encoding = 'utf8' |
| 587 | |
| 588 | while (true) { |
| 589 | switch (encoding) { |
| 590 | case 'hex': |
| 591 | return hexSlice(this, start, end) |
| 592 | |
| 593 | case 'utf8': |
| 594 | case 'utf-8': |
| 595 | return utf8Slice(this, start, end) |
| 596 | |
| 597 | case 'ascii': |
| 598 | return asciiSlice(this, start, end) |
| 599 | |
| 600 | case 'latin1': |
| 601 | case 'binary': |
| 602 | return latin1Slice(this, start, end) |
| 603 | |
| 604 | case 'base64': |
| 605 | return base64Slice(this, start, end) |
| 606 | |
| 607 | case 'ucs2': |
| 608 | case 'ucs-2': |
nothing calls this directly
no test coverage detected
searching dependent graphs…