| 644 | exports.kMaxLength = kMaxLength() |
| 645 | |
| 646 | function typedArraySupport () { |
| 647 | try { |
| 648 | var arr = new Uint8Array(1) |
| 649 | arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} |
| 650 | return arr.foo() === 42 && // typed array instances can be augmented |
| 651 | typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` |
| 652 | arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` |
| 653 | } catch (e) { |
| 654 | return false |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | function kMaxLength () { |
| 659 | return Buffer.TYPED_ARRAY_SUPPORT |