(array, byteOffset, length)
| 357 | } |
| 358 | |
| 359 | function fromArrayBuffer (array, byteOffset, length) { |
| 360 | if (byteOffset < 0 || array.byteLength < byteOffset) { |
| 361 | throw new RangeError('"offset" is outside of buffer bounds') |
| 362 | } |
| 363 | |
| 364 | if (array.byteLength < byteOffset + (length || 0)) { |
| 365 | throw new RangeError('"length" is outside of buffer bounds') |
| 366 | } |
| 367 | |
| 368 | var buf |
| 369 | if (byteOffset === undefined && length === undefined) { |
| 370 | buf = new Uint8Array(array) |
| 371 | } else if (length === undefined) { |
| 372 | buf = new Uint8Array(array, byteOffset) |
| 373 | } else { |
| 374 | buf = new Uint8Array(array, byteOffset, length) |
| 375 | } |
| 376 | |
| 377 | // Return an augmented `Uint8Array` instance |
| 378 | buf.__proto__ = Buffer.prototype |
| 379 | return buf |
| 380 | } |
| 381 | |
| 382 | function fromObject (obj) { |
| 383 | if (Buffer.isBuffer(obj)) { |
no outgoing calls
no test coverage detected
searching dependent graphs…