Socket
Socket
Sign inDemoInstall

@petamoriken/float16

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@petamoriken/float16 - npm Package Compare versions

Comparing version 3.6.0 to 3.6.1

68

browser/float16.js

@@ -1,2 +0,2 @@

/*! @petamoriken/float16 v3.6.0 | MIT License - https://git.io/float16 */
/*! @petamoriken/float16 v3.6.1 | MIT License - https://git.io/float16 */

@@ -141,19 +141,23 @@ const float16 = (function (exports) {

function toSafe(array) {
const arrayIterators = new NativeWeakMap();
const SafeIteratorPrototype = ObjectCreate(null, {
next: {
value: function next() {
const arrayIterator = WeakMapPrototypeGet(arrayIterators, this);
return ArrayIteratorPrototypeNext(arrayIterator);
},
},
[SymbolIterator]: {
value: function values() {
return this;
},
},
});
function safeIfNeeded(array) {
if (array[SymbolIterator] === NativeArrayPrototypeSymbolIterator) {
return array;
}
const arrayIterator = ArrayPrototypeSymbolIterator(array);
return ObjectCreate(null, {
next: {
value: function next() {
return ArrayIteratorPrototypeNext(arrayIterator);
},
},
[SymbolIterator]: {
value: function values() {
return this;
},
},
});
const safe = ObjectCreate(SafeIteratorPrototype);
WeakMapPrototypeSet(arrayIterators, safe, ArrayPrototypeSymbolIterator(array));
return safe;
}

@@ -170,8 +174,10 @@ const generators = new NativeWeakMap();

},
[SymbolToStringTag]: {
value: "Array Iterator",
configurable: true,
},
});
function wrapGenerator(generator) {
for (const key of ReflectOwnKeys(ArrayIteratorPrototype)) {
if (key === "next") {
continue;
}
ObjectDefineProperty(DummyArrayIteratorPrototype, key, ReflectGetOwnPropertyDescriptor(ArrayIteratorPrototype, key));
}
function wrap(generator) {
const dummy = ObjectCreate(DummyArrayIteratorPrototype);

@@ -653,3 +659,3 @@ WeakMapPrototypeSet(generators, dummy, generator);

return roundToFloat16Bits(
ReflectApply(mapFunc, this, [val, ...toSafe(args)])
ReflectApply(mapFunc, this, [val, ...safeIfNeeded(args)])
);

@@ -730,3 +736,3 @@ }, thisArg)

const float16bitsArray = getFloat16BitsArray(this);
return wrapGenerator((function* () {
return wrap((function* () {
for (const val of TypedArrayPrototypeValues(float16bitsArray)) {

@@ -740,3 +746,3 @@ yield convertToNumber(val);

const float16bitsArray = getFloat16BitsArray(this);
return wrapGenerator((function* () {
return wrap((function* () {
for (const [i, val] of TypedArrayPrototypeEntries(float16bitsArray)) {

@@ -1001,3 +1007,3 @@ yield ([i, convertToNumber(val)]);

roundToFloat16Bits(value),
...toSafe(opts)
...safeIfNeeded(opts)
);

@@ -1009,3 +1015,3 @@ return this;

const float16bitsArray = getFloat16BitsArray(this);
TypedArrayPrototypeCopyWithin(float16bitsArray, target, start, ...toSafe(opts));
TypedArrayPrototypeCopyWithin(float16bitsArray, target, start, ...safeIfNeeded(opts));
return this;

@@ -1034,3 +1040,3 @@ }

TypedArrayPrototypeGetBuffer(
TypedArrayPrototypeSlice(uint16, ...toSafe(opts))
TypedArrayPrototypeSlice(uint16, ...safeIfNeeded(opts))
)

@@ -1085,3 +1091,3 @@ );

);
const uint16Subarray = TypedArrayPrototypeSubarray(uint16, ...toSafe(opts));
const uint16Subarray = TypedArrayPrototypeSubarray(uint16, ...safeIfNeeded(opts));
const array = new Constructor(

@@ -1172,3 +1178,3 @@ TypedArrayPrototypeGetBuffer(uint16Subarray),

const array = copyToArray(float16bitsArray);
return ArrayPrototypeJoin(array, ...toSafe(opts));
return ArrayPrototypeJoin(array, ...safeIfNeeded(opts));
}

@@ -1179,3 +1185,3 @@ toLocaleString(...opts) {

const array = copyToArray(float16bitsArray);
return ArrayPrototypeToLocaleString(array, ...toSafe(opts));
return ArrayPrototypeToLocaleString(array, ...safeIfNeeded(opts));
}

@@ -1210,3 +1216,3 @@ get [SymbolToStringTag]() {

return convertToNumber(
DataViewPrototypeGetUint16(dataView, byteOffset, ...toSafe(opts))
DataViewPrototypeGetUint16(dataView, byteOffset, ...safeIfNeeded(opts))
);

@@ -1219,3 +1225,3 @@ }

roundToFloat16Bits(value),
...toSafe(opts)
...safeIfNeeded(opts)
);

@@ -1222,0 +1228,0 @@ }

{
"name": "@petamoriken/float16",
"version": "3.6.0",
"version": "3.6.1",
"description": "IEEE 754 half-precision floating-point for JavaScript",

@@ -74,12 +74,12 @@ "keywords": [

"devDependencies": {
"@babel/cli": "^7.15.7",
"@babel/core": "^7.16.5",
"@babel/plugin-transform-modules-commonjs": "^7.16.5",
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/plugin-transform-modules-commonjs": "^7.16.7",
"@types/nightwatch": "^1.3.4",
"babel-plugin-replace-import-extension": "^1.1.2",
"browserslist": "^4.19.1",
"concurrently": "^6.5.1",
"eslint": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.3.0",
"concurrently": "^7.0.0",
"eslint": "^8.6.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.6.1",
"espower-cli": "^1.1.0",

@@ -95,3 +95,3 @@ "espower-loader": "^1.2.2",

"power-assert": "^1.4.2",
"rollup": "^2.61.1",
"rollup": "^2.63.0",
"rollup-plugin-cleanup": "^3.2.1",

@@ -98,0 +98,0 @@ "source-map-support": "^0.5.21"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc