(array, byteOffset, length)
| 2879 | } |
| 2880 | |
| 2881 | function fromArrayBuffer (array, byteOffset, length) { |
| 2882 | if (byteOffset < 0 || array.byteLength < byteOffset) { |
| 2883 | throw new RangeError('"offset" is outside of buffer bounds') |
| 2884 | } |
| 2885 | |
| 2886 | if (array.byteLength < byteOffset + (length || 0)) { |
| 2887 | throw new RangeError('"length" is outside of buffer bounds') |
| 2888 | } |
| 2889 | |
| 2890 | var buf |
| 2891 | if (byteOffset === undefined && length === undefined) { |
| 2892 | buf = new Uint8Array(array) |
| 2893 | } else if (length === undefined) { |
| 2894 | buf = new Uint8Array(array, byteOffset) |
| 2895 | } else { |
| 2896 | buf = new Uint8Array(array, byteOffset, length) |
| 2897 | } |
| 2898 | |
| 2899 | // Return an augmented `Uint8Array` instance |
| 2900 | buf.__proto__ = Buffer.prototype |
| 2901 | return buf |
| 2902 | } |
| 2903 | |
| 2904 | function fromObject (obj) { |
| 2905 | if (Buffer.isBuffer(obj)) { |
no outgoing calls
no test coverage detected
searching dependent graphs…