Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.5.2 to 3.5.3

85

browser/float16.js

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

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

@@ -26,2 +26,3 @@ const float16 = (function (exports) {

apply: ReflectApply,
construct: ReflectConstruct,
get: ReflectGet,

@@ -724,7 +725,10 @@ getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor,

// from another Float16Array instance (a different version?)
const cloned = new Float16Array(
const cloned = ReflectConstruct(Float16Array, [
// @ts-ignore
float16.buffer,
// @ts-ignore
float16.byteOffset,
float16.length
);
// @ts-ignore
float16.length,
], float16.constructor);
return WeakMapPrototypeGet(targets, cloned);

@@ -785,10 +789,11 @@ }

/** limitation: `Object.getPrototypeOf(Float16Array)` returns `Uint16Array` */
class Float16Array extends NativeUint16Array {
class Float16Array {
/** @see https://tc39.es/ecma262/#sec-typedarray */
constructor(input, byteOffset, length) {
constructor(input, _byteOffset, _length) {
/** @type {Uint16Array & { __float16bits: never }} */
let float16bitsArray;
if (isFloat16Array(input)) {
// peel off Proxy
const float16bitsArray = getFloat16BitsArray(input);
super(float16bitsArray);
float16bitsArray = ReflectConstruct(NativeUint16Array, [getFloat16BitsArray(input)], new.target);
} else if (isObject(input) && !isArrayBuffer(input)) { // object without ArrayBuffer

@@ -820,18 +825,18 @@ /** @type {ArrayLike<unknown>} */

);
super(data);
} else if (isIterable(input)) { // Iterable (Array)
// for optimization
if (isOrdinaryArray(input)) {
list = input;
length = input.length;
super(length);
} else {
list = [...input];
length = list.length;
super(length);
float16bitsArray = ReflectConstruct(NativeUint16Array, [data], new.target);
} else {
if (isIterable(input)) { // Iterable (Array)
// for optimization
if (isOrdinaryArray(input)) {
list = input;
length = input.length;
} else {
list = [...input];
length = list.length;
}
} else { // ArrayLike
list = /** @type {ArrayLike<unknown>} */ (input);
length = LengthOfArrayLike(input);
}
} else { // ArrayLike
list = /** @type {ArrayLike<unknown>} */ (input);
length = LengthOfArrayLike(input);
super(length);
float16bitsArray = ReflectConstruct(NativeUint16Array, [length], new.target);
}

@@ -841,33 +846,12 @@

for (let i = 0; i < length; ++i) {
// super (Uint16Array)
this[i] = roundToFloat16Bits(list[i]);
float16bitsArray[i] = roundToFloat16Bits(list[i]);
}
} else { // primitive, ArrayBuffer
switch (arguments.length) {
case 0:
super();
break;
case 1:
super(input);
break;
case 2:
super(input, byteOffset);
break;
case 3:
super(input, byteOffset, length);
break;
default:
// @ts-ignore
super(...arguments);
}
float16bitsArray = ReflectConstruct(NativeUint16Array, arguments, new.target);
}
const proxy = new NativeProxy(this, handler);
const proxy = new NativeProxy(/** @type {any} */ (float16bitsArray), handler);
// proxy private storage
WeakMapPrototypeSet(targets, proxy, /** @type {any} */ (this));
WeakMapPrototypeSet(targets, proxy, float16bitsArray);

@@ -1622,2 +1606,5 @@ return proxy;

/** @see https://tc39.es/ecma262/#sec-properties-of-the-typedarray-constructors */
ReflectSetPrototypeOf(Float16Array, TypedArray);
const Float16ArrayPrototype = Float16Array.prototype;

@@ -1624,0 +1611,0 @@

{
"name": "@petamoriken/float16",
"version": "3.5.2",
"version": "3.5.3",
"description": "half precision floating point for JavaScript",

@@ -5,0 +5,0 @@ "keywords": [

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