(that, value, encodingOrOffset, length)
| 412 | } |
| 413 | |
| 414 | function from (that, value, encodingOrOffset, length) { |
| 415 | if (typeof value === 'number') { |
| 416 | throw new TypeError('"value" argument must not be a number') |
| 417 | } |
| 418 | |
| 419 | if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { |
| 420 | return fromArrayBuffer(that, value, encodingOrOffset, length) |
| 421 | } |
| 422 | |
| 423 | if (typeof value === 'string') { |
| 424 | return fromString(that, value, encodingOrOffset) |
| 425 | } |
| 426 | |
| 427 | return fromObject(that, value) |
| 428 | } |
| 429 | |
| 430 | /** |
| 431 | * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError |
no test coverage detected