(that, value, encodingOrOffset, length)
| 716 | } |
| 717 | |
| 718 | function from (that, value, encodingOrOffset, length) { |
| 719 | if (typeof value === 'number') { |
| 720 | throw new TypeError('"value" argument must not be a number') |
| 721 | } |
| 722 | |
| 723 | if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { |
| 724 | return fromArrayBuffer(that, value, encodingOrOffset, length) |
| 725 | } |
| 726 | |
| 727 | if (typeof value === 'string') { |
| 728 | return fromString(that, value, encodingOrOffset) |
| 729 | } |
| 730 | |
| 731 | return fromObject(that, value) |
| 732 | } |
| 733 | |
| 734 | /** |
| 735 | * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError |
no test coverage detected