UNPKG

662 BJavaScriptView Raw
1'use strict';
2var $ = require('../internals/export');
3var uncurryThis = require('../internals/function-uncurry-this');
4var unpackIEEE754 = require('../internals/ieee754').unpack;
5
6// eslint-disable-next-line es/no-typed-arrays -- safe
7var getUint16 = uncurryThis(DataView.prototype.getUint16);
8
9// `DataView.prototype.getFloat16` method
10// https://github.com/tc39/proposal-float16array
11$({ target: 'DataView', proto: true }, {
12 getFloat16: function getFloat16(byteOffset /* , littleEndian */) {
13 var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false);
14 return unpackIEEE754([uint16 & 0xFF, uint16 >> 8 & 0xFF], 10);
15 }
16});