@petamoriken/float16
Advanced tools
Comparing version 1.0.7 to 1.0.8
/** | ||
* @petamoriken/float16 c1bef73 | MIT License - https://git.io/float16 | ||
* @petamoriken/float16 0983c82 | MIT License - https://git.io/float16 | ||
* | ||
@@ -247,2 +247,3 @@ * @license | ||
value[symToStringTag] = undefined; | ||
var unmasked = true; | ||
} catch (e) {} | ||
@@ -252,3 +253,3 @@ | ||
{ | ||
if (unmasked) { | ||
if (isOwn) { | ||
@@ -1314,7 +1315,11 @@ value[symToStringTag] = tag; | ||
static from(src, ...opts) { | ||
if (opts.length === 0) return new Float16Array(Uint16Array.from(src, roundToFloat16Bits).buffer); | ||
const mapFunc = opts[0]; | ||
const thisArg = opts[1]; | ||
return new Float16Array(Uint16Array.from(src, function (val, ...args) { | ||
static from(src) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) return new Float16Array(Uint16Array.from(src, roundToFloat16Bits).buffer); | ||
const mapFunc = arguments.length <= 1 ? undefined : arguments[1]; | ||
const thisArg = arguments.length <= 2 ? undefined : arguments[2]; | ||
return new Float16Array(Uint16Array.from(src, function (val) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return roundToFloat16Bits(mapFunc.call(this, val, ...args)); | ||
@@ -1324,3 +1329,7 @@ }, thisArg).buffer); | ||
static of(...args) { | ||
static of() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return new Float16Array(args); | ||
@@ -1357,5 +1366,5 @@ } // iterate methods | ||
map(callback, ...opts) { | ||
map(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
const array = []; | ||
@@ -1371,5 +1380,5 @@ | ||
filter(callback, ...opts) { | ||
filter(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
const array = []; | ||
@@ -1388,11 +1397,11 @@ | ||
reduce(callback, ...opts) { | ||
reduce(callback) { | ||
assertFloat16Array(this); | ||
let val, start; | ||
if (opts.length === 0) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) { | ||
val = convertToNumber(this[0]); | ||
start = 1; | ||
} else { | ||
val = opts[0]; | ||
val = arguments.length <= 1 ? undefined : arguments[1]; | ||
start = 0; | ||
@@ -1408,3 +1417,3 @@ } | ||
reduceRight(callback, ...opts) { | ||
reduceRight(callback) { | ||
assertFloat16Array(this); | ||
@@ -1414,7 +1423,7 @@ let val, start; | ||
if (opts.length === 0) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) { | ||
val = convertToNumber(this[length - 1]); | ||
start = length - 1; | ||
} else { | ||
val = opts[0]; | ||
val = arguments.length <= 1 ? undefined : arguments[1]; | ||
start = length; | ||
@@ -1430,5 +1439,5 @@ } | ||
forEach(callback, ...opts) { | ||
forEach(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1440,5 +1449,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
find(callback, ...opts) { | ||
find(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1451,5 +1460,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
findIndex(callback, ...opts) { | ||
findIndex(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1464,5 +1473,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
every(callback, ...opts) { | ||
every(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1476,5 +1485,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
some(callback, ...opts) { | ||
some(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1489,5 +1498,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
set(input, ...opts) { | ||
set(input) { | ||
assertFloat16Array(this); | ||
const offset = opts[0]; | ||
const offset = arguments.length <= 1 ? undefined : arguments[1]; | ||
let float16bits; // input Float16Array | ||
@@ -1516,4 +1525,9 @@ | ||
fill(value, ...opts) { | ||
fill(value) { | ||
assertFloat16Array(this); | ||
for (var _len3 = arguments.length, opts = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
opts[_key3 - 1] = arguments[_key3]; | ||
} | ||
super.fill(roundToFloat16Bits(value), ...opts); | ||
@@ -1523,4 +1537,9 @@ return _(this).proxy; | ||
copyWithin(target, start, ...opts) { | ||
copyWithin(target, start) { | ||
assertFloat16Array(this); | ||
for (var _len4 = arguments.length, opts = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
opts[_key4 - 2] = arguments[_key4]; | ||
} | ||
super.copyWithin(target, start, ...opts); | ||
@@ -1530,5 +1549,5 @@ return _(this).proxy; | ||
sort(...opts) { | ||
sort() { | ||
assertFloat16Array(this); | ||
let compareFunction = opts[0]; | ||
let compareFunction = arguments.length <= 0 ? undefined : arguments[0]; | ||
@@ -1546,3 +1565,3 @@ if (compareFunction === undefined) { | ||
slice(...opts) { | ||
slice() { | ||
assertFloat16Array(this); | ||
@@ -1552,7 +1571,7 @@ let float16bits; // V8, SpiderMonkey, JavaScriptCore, Chakra throw TypeError | ||
try { | ||
float16bits = super.slice(...opts); | ||
float16bits = super.slice(...arguments); | ||
} catch (e) { | ||
if (e instanceof TypeError) { | ||
const uint16 = new Uint16Array(this.buffer, this.byteOffset, this.length); | ||
float16bits = uint16.slice(...opts); | ||
float16bits = uint16.slice(...arguments); | ||
} else { | ||
@@ -1566,3 +1585,3 @@ throw e; | ||
subarray(...opts) { | ||
subarray() { | ||
assertFloat16Array(this); | ||
@@ -1572,7 +1591,7 @@ let float16bits; // V8, SpiderMonkey, JavaScriptCore, Chakra throw TypeError | ||
try { | ||
float16bits = super.subarray(...opts); | ||
float16bits = super.subarray(...arguments); | ||
} catch (e) { | ||
if (e instanceof TypeError) { | ||
const uint16 = new Uint16Array(this.buffer, this.byteOffset, this.length); | ||
float16bits = uint16.subarray(...opts); | ||
float16bits = uint16.subarray(...arguments); | ||
} else { | ||
@@ -1587,6 +1606,6 @@ throw e; | ||
indexOf(element, ...opts) { | ||
indexOf(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = ToInteger(opts[0]); | ||
let from = ToInteger(arguments.length <= 1 ? undefined : arguments[1]); | ||
@@ -1605,6 +1624,6 @@ if (from < 0) { | ||
lastIndexOf(element, ...opts) { | ||
lastIndexOf(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = ToInteger(opts[0]); | ||
let from = ToInteger(arguments.length <= 1 ? undefined : arguments[1]); | ||
from = from === 0 ? length : from + 1; | ||
@@ -1625,6 +1644,6 @@ | ||
includes(element, ...opts) { | ||
includes(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = ToInteger(opts[0]); | ||
let from = ToInteger(arguments.length <= 1 ? undefined : arguments[1]); | ||
@@ -1648,12 +1667,12 @@ if (from < 0) { | ||
join(...opts) { | ||
join() { | ||
assertFloat16Array(this); | ||
const array = copyToArray(this); | ||
return array.join(...opts); | ||
return array.join(...arguments); | ||
} | ||
toLocaleString(...opts) { | ||
toLocaleString() { | ||
assertFloat16Array(this); | ||
const array = copyToArray(this); | ||
return array.toLocaleString(...opts); | ||
return array.toLocaleString(...arguments); | ||
} | ||
@@ -1681,4 +1700,9 @@ | ||
function getFloat16(dataView, byteOffset, ...opts) { | ||
function getFloat16(dataView, byteOffset) { | ||
if (!isDataView(dataView)) throw new TypeError("First argument to getFloat16 function must be a DataView"); | ||
for (var _len = arguments.length, opts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
opts[_key - 2] = arguments[_key]; | ||
} | ||
return convertToNumber(dataView.getUint16(byteOffset, ...opts)); | ||
@@ -1694,4 +1718,9 @@ } | ||
function setFloat16(dataView, byteOffset, value, ...opts) { | ||
function setFloat16(dataView, byteOffset, value) { | ||
if (!isDataView(dataView)) throw new TypeError("First argument to setFloat16 function must be a DataView"); | ||
for (var _len2 = arguments.length, opts = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { | ||
opts[_key2 - 3] = arguments[_key2]; | ||
} | ||
dataView.setUint16(byteOffset, roundToFloat16Bits(value), ...opts); | ||
@@ -1698,0 +1727,0 @@ } |
/** | ||
* @petamoriken/float16 c1bef73 | MIT License - https://git.io/float16 | ||
* @petamoriken/float16 0983c82 | MIT License - https://git.io/float16 | ||
* | ||
@@ -247,2 +247,3 @@ * @license | ||
value[symToStringTag] = undefined; | ||
var unmasked = true; | ||
} catch (e) {} | ||
@@ -252,3 +253,3 @@ | ||
{ | ||
if (unmasked) { | ||
if (isOwn) { | ||
@@ -1314,7 +1315,11 @@ value[symToStringTag] = tag; | ||
static from(src, ...opts) { | ||
if (opts.length === 0) return new Float16Array(Uint16Array.from(src, roundToFloat16Bits).buffer); | ||
const mapFunc = opts[0]; | ||
const thisArg = opts[1]; | ||
return new Float16Array(Uint16Array.from(src, function (val, ...args) { | ||
static from(src) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) return new Float16Array(Uint16Array.from(src, roundToFloat16Bits).buffer); | ||
const mapFunc = arguments.length <= 1 ? undefined : arguments[1]; | ||
const thisArg = arguments.length <= 2 ? undefined : arguments[2]; | ||
return new Float16Array(Uint16Array.from(src, function (val) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return roundToFloat16Bits(mapFunc.call(this, val, ...args)); | ||
@@ -1324,3 +1329,7 @@ }, thisArg).buffer); | ||
static of(...args) { | ||
static of() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return new Float16Array(args); | ||
@@ -1357,5 +1366,5 @@ } // iterate methods | ||
map(callback, ...opts) { | ||
map(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
const array = []; | ||
@@ -1371,5 +1380,5 @@ | ||
filter(callback, ...opts) { | ||
filter(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
const array = []; | ||
@@ -1388,11 +1397,11 @@ | ||
reduce(callback, ...opts) { | ||
reduce(callback) { | ||
assertFloat16Array(this); | ||
let val, start; | ||
if (opts.length === 0) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) { | ||
val = convertToNumber(this[0]); | ||
start = 1; | ||
} else { | ||
val = opts[0]; | ||
val = arguments.length <= 1 ? undefined : arguments[1]; | ||
start = 0; | ||
@@ -1408,3 +1417,3 @@ } | ||
reduceRight(callback, ...opts) { | ||
reduceRight(callback) { | ||
assertFloat16Array(this); | ||
@@ -1414,7 +1423,7 @@ let val, start; | ||
if (opts.length === 0) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) { | ||
val = convertToNumber(this[length - 1]); | ||
start = length - 1; | ||
} else { | ||
val = opts[0]; | ||
val = arguments.length <= 1 ? undefined : arguments[1]; | ||
start = length; | ||
@@ -1430,5 +1439,5 @@ } | ||
forEach(callback, ...opts) { | ||
forEach(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1440,5 +1449,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
find(callback, ...opts) { | ||
find(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1451,5 +1460,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
findIndex(callback, ...opts) { | ||
findIndex(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1464,5 +1473,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
every(callback, ...opts) { | ||
every(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1476,5 +1485,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
some(callback, ...opts) { | ||
some(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -1489,5 +1498,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
set(input, ...opts) { | ||
set(input) { | ||
assertFloat16Array(this); | ||
const offset = opts[0]; | ||
const offset = arguments.length <= 1 ? undefined : arguments[1]; | ||
let float16bits; // input Float16Array | ||
@@ -1516,4 +1525,9 @@ | ||
fill(value, ...opts) { | ||
fill(value) { | ||
assertFloat16Array(this); | ||
for (var _len3 = arguments.length, opts = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
opts[_key3 - 1] = arguments[_key3]; | ||
} | ||
super.fill(roundToFloat16Bits(value), ...opts); | ||
@@ -1523,4 +1537,9 @@ return _(this).proxy; | ||
copyWithin(target, start, ...opts) { | ||
copyWithin(target, start) { | ||
assertFloat16Array(this); | ||
for (var _len4 = arguments.length, opts = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
opts[_key4 - 2] = arguments[_key4]; | ||
} | ||
super.copyWithin(target, start, ...opts); | ||
@@ -1530,5 +1549,5 @@ return _(this).proxy; | ||
sort(...opts) { | ||
sort() { | ||
assertFloat16Array(this); | ||
let compareFunction = opts[0]; | ||
let compareFunction = arguments.length <= 0 ? undefined : arguments[0]; | ||
@@ -1546,3 +1565,3 @@ if (compareFunction === undefined) { | ||
slice(...opts) { | ||
slice() { | ||
assertFloat16Array(this); | ||
@@ -1552,7 +1571,7 @@ let float16bits; // V8, SpiderMonkey, JavaScriptCore, Chakra throw TypeError | ||
try { | ||
float16bits = super.slice(...opts); | ||
float16bits = super.slice(...arguments); | ||
} catch (e) { | ||
if (e instanceof TypeError) { | ||
const uint16 = new Uint16Array(this.buffer, this.byteOffset, this.length); | ||
float16bits = uint16.slice(...opts); | ||
float16bits = uint16.slice(...arguments); | ||
} else { | ||
@@ -1566,3 +1585,3 @@ throw e; | ||
subarray(...opts) { | ||
subarray() { | ||
assertFloat16Array(this); | ||
@@ -1572,7 +1591,7 @@ let float16bits; // V8, SpiderMonkey, JavaScriptCore, Chakra throw TypeError | ||
try { | ||
float16bits = super.subarray(...opts); | ||
float16bits = super.subarray(...arguments); | ||
} catch (e) { | ||
if (e instanceof TypeError) { | ||
const uint16 = new Uint16Array(this.buffer, this.byteOffset, this.length); | ||
float16bits = uint16.subarray(...opts); | ||
float16bits = uint16.subarray(...arguments); | ||
} else { | ||
@@ -1587,6 +1606,6 @@ throw e; | ||
indexOf(element, ...opts) { | ||
indexOf(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = ToInteger(opts[0]); | ||
let from = ToInteger(arguments.length <= 1 ? undefined : arguments[1]); | ||
@@ -1605,6 +1624,6 @@ if (from < 0) { | ||
lastIndexOf(element, ...opts) { | ||
lastIndexOf(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = ToInteger(opts[0]); | ||
let from = ToInteger(arguments.length <= 1 ? undefined : arguments[1]); | ||
from = from === 0 ? length : from + 1; | ||
@@ -1625,6 +1644,6 @@ | ||
includes(element, ...opts) { | ||
includes(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = ToInteger(opts[0]); | ||
let from = ToInteger(arguments.length <= 1 ? undefined : arguments[1]); | ||
@@ -1648,12 +1667,12 @@ if (from < 0) { | ||
join(...opts) { | ||
join() { | ||
assertFloat16Array(this); | ||
const array = copyToArray(this); | ||
return array.join(...opts); | ||
return array.join(...arguments); | ||
} | ||
toLocaleString(...opts) { | ||
toLocaleString() { | ||
assertFloat16Array(this); | ||
const array = copyToArray(this); | ||
return array.toLocaleString(...opts); | ||
return array.toLocaleString(...arguments); | ||
} | ||
@@ -1681,4 +1700,9 @@ | ||
function getFloat16(dataView, byteOffset, ...opts) { | ||
function getFloat16(dataView, byteOffset) { | ||
if (!isDataView(dataView)) throw new TypeError("First argument to getFloat16 function must be a DataView"); | ||
for (var _len = arguments.length, opts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
opts[_key - 2] = arguments[_key]; | ||
} | ||
return convertToNumber(dataView.getUint16(byteOffset, ...opts)); | ||
@@ -1694,4 +1718,9 @@ } | ||
function setFloat16(dataView, byteOffset, value, ...opts) { | ||
function setFloat16(dataView, byteOffset, value) { | ||
if (!isDataView(dataView)) throw new TypeError("First argument to setFloat16 function must be a DataView"); | ||
for (var _len2 = arguments.length, opts = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { | ||
opts[_key2 - 3] = arguments[_key2]; | ||
} | ||
dataView.setUint16(byteOffset, roundToFloat16Bits(value), ...opts); | ||
@@ -1698,0 +1727,0 @@ } |
@@ -19,4 +19,9 @@ "use strict"; | ||
*/ | ||
function getFloat16(dataView, byteOffset, ...opts) { | ||
function getFloat16(dataView, byteOffset) { | ||
if (!(0, _is.isDataView)(dataView)) throw new TypeError("First argument to getFloat16 function must be a DataView"); | ||
for (var _len = arguments.length, opts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
opts[_key - 2] = arguments[_key]; | ||
} | ||
return (0, _lib.convertToNumber)(dataView.getUint16(byteOffset, ...opts)); | ||
@@ -33,5 +38,10 @@ } | ||
function setFloat16(dataView, byteOffset, value, ...opts) { | ||
function setFloat16(dataView, byteOffset, value) { | ||
if (!(0, _is.isDataView)(dataView)) throw new TypeError("First argument to setFloat16 function must be a DataView"); | ||
for (var _len2 = arguments.length, opts = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { | ||
opts[_key2 - 3] = arguments[_key2]; | ||
} | ||
dataView.setUint16(byteOffset, (0, _lib.roundToFloat16Bits)(value), ...opts); | ||
} |
@@ -198,7 +198,11 @@ "use strict"; | ||
static from(src, ...opts) { | ||
if (opts.length === 0) return new Float16Array(Uint16Array.from(src, _lib.roundToFloat16Bits).buffer); | ||
const mapFunc = opts[0]; | ||
const thisArg = opts[1]; | ||
return new Float16Array(Uint16Array.from(src, function (val, ...args) { | ||
static from(src) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) return new Float16Array(Uint16Array.from(src, _lib.roundToFloat16Bits).buffer); | ||
const mapFunc = arguments.length <= 1 ? undefined : arguments[1]; | ||
const thisArg = arguments.length <= 2 ? undefined : arguments[2]; | ||
return new Float16Array(Uint16Array.from(src, function (val) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return (0, _lib.roundToFloat16Bits)(mapFunc.call(this, val, ...args)); | ||
@@ -208,3 +212,7 @@ }, thisArg).buffer); | ||
static of(...args) { | ||
static of() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return new Float16Array(args); | ||
@@ -241,5 +249,5 @@ } // iterate methods | ||
map(callback, ...opts) { | ||
map(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
const array = []; | ||
@@ -255,5 +263,5 @@ | ||
filter(callback, ...opts) { | ||
filter(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
const array = []; | ||
@@ -272,11 +280,11 @@ | ||
reduce(callback, ...opts) { | ||
reduce(callback) { | ||
assertFloat16Array(this); | ||
let val, start; | ||
if (opts.length === 0) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) { | ||
val = (0, _lib.convertToNumber)(this[0]); | ||
start = 1; | ||
} else { | ||
val = opts[0]; | ||
val = arguments.length <= 1 ? undefined : arguments[1]; | ||
start = 0; | ||
@@ -292,3 +300,3 @@ } | ||
reduceRight(callback, ...opts) { | ||
reduceRight(callback) { | ||
assertFloat16Array(this); | ||
@@ -298,7 +306,7 @@ let val, start; | ||
if (opts.length === 0) { | ||
if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) { | ||
val = (0, _lib.convertToNumber)(this[length - 1]); | ||
start = length - 1; | ||
} else { | ||
val = opts[0]; | ||
val = arguments.length <= 1 ? undefined : arguments[1]; | ||
start = length; | ||
@@ -314,5 +322,5 @@ } | ||
forEach(callback, ...opts) { | ||
forEach(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -324,5 +332,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
find(callback, ...opts) { | ||
find(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -335,5 +343,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
findIndex(callback, ...opts) { | ||
findIndex(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -348,5 +356,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
every(callback, ...opts) { | ||
every(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -360,5 +368,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
some(callback, ...opts) { | ||
some(callback) { | ||
assertFloat16Array(this); | ||
const thisArg = opts[0]; | ||
const thisArg = arguments.length <= 1 ? undefined : arguments[1]; | ||
@@ -373,5 +381,5 @@ for (let i = 0, l = this.length; i < l; ++i) { | ||
set(input, ...opts) { | ||
set(input) { | ||
assertFloat16Array(this); | ||
const offset = opts[0]; | ||
const offset = arguments.length <= 1 ? undefined : arguments[1]; | ||
let float16bits; // input Float16Array | ||
@@ -400,4 +408,9 @@ | ||
fill(value, ...opts) { | ||
fill(value) { | ||
assertFloat16Array(this); | ||
for (var _len3 = arguments.length, opts = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
opts[_key3 - 1] = arguments[_key3]; | ||
} | ||
super.fill((0, _lib.roundToFloat16Bits)(value), ...opts); | ||
@@ -407,4 +420,9 @@ return _(this).proxy; | ||
copyWithin(target, start, ...opts) { | ||
copyWithin(target, start) { | ||
assertFloat16Array(this); | ||
for (var _len4 = arguments.length, opts = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
opts[_key4 - 2] = arguments[_key4]; | ||
} | ||
super.copyWithin(target, start, ...opts); | ||
@@ -414,5 +432,5 @@ return _(this).proxy; | ||
sort(...opts) { | ||
sort() { | ||
assertFloat16Array(this); | ||
let compareFunction = opts[0]; | ||
let compareFunction = arguments.length <= 0 ? undefined : arguments[0]; | ||
@@ -430,3 +448,3 @@ if (compareFunction === undefined) { | ||
slice(...opts) { | ||
slice() { | ||
assertFloat16Array(this); | ||
@@ -436,7 +454,7 @@ let float16bits; // V8, SpiderMonkey, JavaScriptCore, Chakra throw TypeError | ||
try { | ||
float16bits = super.slice(...opts); | ||
float16bits = super.slice(...arguments); | ||
} catch (e) { | ||
if (e instanceof TypeError) { | ||
const uint16 = new Uint16Array(this.buffer, this.byteOffset, this.length); | ||
float16bits = uint16.slice(...opts); | ||
float16bits = uint16.slice(...arguments); | ||
} else { | ||
@@ -450,3 +468,3 @@ throw e; | ||
subarray(...opts) { | ||
subarray() { | ||
assertFloat16Array(this); | ||
@@ -456,7 +474,7 @@ let float16bits; // V8, SpiderMonkey, JavaScriptCore, Chakra throw TypeError | ||
try { | ||
float16bits = super.subarray(...opts); | ||
float16bits = super.subarray(...arguments); | ||
} catch (e) { | ||
if (e instanceof TypeError) { | ||
const uint16 = new Uint16Array(this.buffer, this.byteOffset, this.length); | ||
float16bits = uint16.subarray(...opts); | ||
float16bits = uint16.subarray(...arguments); | ||
} else { | ||
@@ -471,6 +489,6 @@ throw e; | ||
indexOf(element, ...opts) { | ||
indexOf(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = (0, _spec.ToInteger)(opts[0]); | ||
let from = (0, _spec.ToInteger)(arguments.length <= 1 ? undefined : arguments[1]); | ||
@@ -489,6 +507,6 @@ if (from < 0) { | ||
lastIndexOf(element, ...opts) { | ||
lastIndexOf(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = (0, _spec.ToInteger)(opts[0]); | ||
let from = (0, _spec.ToInteger)(arguments.length <= 1 ? undefined : arguments[1]); | ||
from = from === 0 ? length : from + 1; | ||
@@ -509,6 +527,6 @@ | ||
includes(element, ...opts) { | ||
includes(element) { | ||
assertFloat16Array(this); | ||
const length = this.length; | ||
let from = (0, _spec.ToInteger)(opts[0]); | ||
let from = (0, _spec.ToInteger)(arguments.length <= 1 ? undefined : arguments[1]); | ||
@@ -532,12 +550,12 @@ if (from < 0) { | ||
join(...opts) { | ||
join() { | ||
assertFloat16Array(this); | ||
const array = copyToArray(this); | ||
return array.join(...opts); | ||
return array.join(...arguments); | ||
} | ||
toLocaleString(...opts) { | ||
toLocaleString() { | ||
assertFloat16Array(this); | ||
const array = copyToArray(this); | ||
return array.toLocaleString(...opts); | ||
return array.toLocaleString(...arguments); | ||
} | ||
@@ -544,0 +562,0 @@ |
@@ -1,12 +0,107 @@ | ||
const settings = require("./nightwatch.json"); | ||
const { SAUCE_USERNAME, SAUCE_ACCESS_KEY, TRAVIS_JOB_NUMBER, TRAVIS_BRANCH, TRAVIS_PULL_REQUEST } = process.env; | ||
const { TRAVIS_JOB_NUMBER, TRAVIS_BRANCH, TRAVIS_PULL_REQUEST } = process.env; | ||
if(TRAVIS_JOB_NUMBER) { | ||
const desiredCapabilities = settings.test_settings.default.desiredCapabilities; | ||
if(TRAVIS_BRANCH === "master" && TRAVIS_PULL_REQUEST === "false") { | ||
desiredCapabilities.build = `build-${ TRAVIS_JOB_NUMBER }`; | ||
} | ||
desiredCapabilities["tunnel-identifier"] = TRAVIS_JOB_NUMBER; | ||
} | ||
module.exports = { | ||
src_folders: "test/browser", | ||
output_folder: "test_report", | ||
custom_commands_path: "test/nightwatch_custom", | ||
module.exports = settings; | ||
test_workers: { | ||
enabled: true, | ||
workers: "auto", | ||
}, | ||
test_settings: { | ||
default: { | ||
launch_url: "http://localhost", | ||
selenium_host: "ondemand.saucelabs.com", | ||
selenium_port: 80, | ||
webdriver: { | ||
username: SAUCE_USERNAME, | ||
access_key: SAUCE_ACCESS_KEY, | ||
default_path_prefix: "/wd/hub", | ||
}, | ||
desiredCapabilities: { | ||
javascriptEnabled: true, | ||
acceptSslCerts: true, | ||
"tunnel-identifier": TRAVIS_JOB_NUMBER, | ||
...(TRAVIS_BRANCH === "master" && TRAVIS_PULL_REQUEST === "false" ? { | ||
build: `build-${ TRAVIS_JOB_NUMBER }` | ||
} : {}) | ||
}, | ||
}, | ||
chrome: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "chrome", | ||
version: "latest", | ||
}, | ||
}, | ||
chrome_old: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "chrome", | ||
version: "latest-1", | ||
}, | ||
}, | ||
firefox: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "firefox", | ||
version: "latest", | ||
}, | ||
}, | ||
firefox_old: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "firefox", | ||
version: "latest-1", | ||
}, | ||
}, | ||
firefox_esr: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "firefox", | ||
version: "60.0", | ||
}, | ||
}, | ||
edge: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "MicrosoftEdge", | ||
version: "latest", | ||
}, | ||
}, | ||
edge_old: { | ||
desiredCapabilities: { | ||
platform: "Windows 10", | ||
browserName: "MicrosoftEdge", | ||
version: "latest-1", | ||
}, | ||
}, | ||
safari: { | ||
desiredCapabilities: { | ||
platform: "macOS 10.13", | ||
browserName: "safari", | ||
version: "latest", | ||
}, | ||
}, | ||
safari_old: { | ||
desiredCapabilities: { | ||
platform: "macOS 10.12", | ||
browserName: "safari", | ||
version: "latest", | ||
}, | ||
}, | ||
}, | ||
}; |
{ | ||
"name": "@petamoriken/float16", | ||
"description": "half precision floating point for JavaScript", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"main": "lib/index.js", | ||
@@ -67,3 +67,3 @@ "jsnext:main": "src/index.js", | ||
"@babel/preset-env": "^7.0.0", | ||
"babel-eslint": "^9.0.0", | ||
"babel-eslint": "^10.0.0", | ||
"babel-plugin-add-module-exports": "^1.0.0", | ||
@@ -76,9 +76,9 @@ "babel-plugin-module-resolver": "^3.0.0", | ||
"mocha": "^5.0.0", | ||
"nightwatch": "^0.9.15", | ||
"nightwatch": "^1.0.18", | ||
"power-assert": "^1.4.2", | ||
"rollup": "^0.66.2", | ||
"rollup-load-plugins": "^0.3.0", | ||
"rollup": "^1.0.0", | ||
"rollup-load-plugins": "^0.4.0", | ||
"rollup-plugin-babel": "^4.0.1", | ||
"rollup-plugin-license": "^0.7.0", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"saucelabs": "^1.4.0" | ||
@@ -85,0 +85,0 @@ }, |
@@ -9,4 +9,3 @@ import { execSync } from "child_process"; | ||
const banner = | ||
`<%= pkg.name %> ${ gitTag || gitCommitHash } | <%= pkg.license %> License - <%= pkg.homepage %> | ||
const banner = `<%= pkg.name %> ${ gitTag || gitCommitHash } | <%= pkg.license %> License - <%= pkg.homepage %> | ||
@@ -13,0 +12,0 @@ @license<% _.forEach(dependencies, function (dependency) { %> |
@@ -12,3 +12,3 @@ "use strict"; | ||
console.log("SauceOnDemandSessionID: ", sessionId); | ||
const saucelabs = new SauceLabs({ | ||
@@ -15,0 +15,0 @@ username: SAUCE_USERNAME, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1823584
38900
20
55