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 2.0.0 to 3.0.0

152

browser/float16.js
/**
* @petamoriken/float16 e52b20a | MIT License - https://git.io/float16
* @petamoriken/float16 f625698 | MIT License - https://git.io/float16
*
* @license
* lodash-es v4.17.15 | MIT License - https://lodash.com/custom-builds
* lodash-es v4.17.21 | MIT License - https://lodash.com/custom-builds
*/

@@ -158,6 +158,6 @@

var objectProto = Object.prototype;
var objectProto$4 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
/**

@@ -169,6 +169,6 @@ * Used to resolve the

var nativeObjectToString = objectProto.toString;
var nativeObjectToString$1 = objectProto$4.toString;
/** Built-in value references. */
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
/**

@@ -183,17 +183,17 @@ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.

function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag] = undefined;
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
var result = nativeObjectToString$1.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag];
delete value[symToStringTag$1];
}

@@ -206,3 +206,3 @@ }

/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
var objectProto$3 = Object.prototype;
/**

@@ -214,3 +214,3 @@ * Used to resolve the

var nativeObjectToString$1 = objectProto$1.toString;
var nativeObjectToString = objectProto$3.toString;
/**

@@ -225,3 +225,3 @@ * Converts `value` to a string using `Object.prototype.toString`.

function objectToString(value) {
return nativeObjectToString$1.call(value);
return nativeObjectToString.call(value);
}

@@ -235,3 +235,3 @@

var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
/**

@@ -250,3 +250,3 @@ * The base implementation of `getTag` without fallbacks for buggy environments.

return symToStringTag$1 && symToStringTag$1 in Object(value) ? getRawTag(value) : objectToString(value);
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}

@@ -343,6 +343,6 @@

/** Used for built-in method references. */
var funcProto = Function.prototype;
var funcProto$1 = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
var funcToString$1 = funcProto$1.toString;
/**

@@ -359,3 +359,3 @@ * Converts `func` to its source code.

try {
return funcToString.call(func);
return funcToString$1.call(func);
} catch (e) {}

@@ -382,13 +382,13 @@

var funcProto$1 = Function.prototype,
var funcProto = Function.prototype,
objectProto$2 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' + funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
/**

@@ -473,9 +473,9 @@ * The base implementation of `_.isNative` without bad shim checks.

var HASH_UNDEFINED = '__lodash_hash_undefined__';
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
var objectProto$1 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
/**

@@ -496,6 +496,6 @@ * Gets the hash value for `key`.

var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
return result === HASH_UNDEFINED$1 ? undefined : result;
}
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
}

@@ -505,6 +505,6 @@

var objectProto$4 = Object.prototype;
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
var hasOwnProperty = objectProto.hasOwnProperty;
/**

@@ -522,3 +522,3 @@ * Checks if a hash value for `key` exists.

var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty$3.call(data, key);
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}

@@ -528,3 +528,3 @@

var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**

@@ -544,3 +544,3 @@ * Sets the hash `key` to `value`.

this.size += this.has(key) ? 0 : 1;
data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value;
data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
return this;

@@ -972,8 +972,2 @@ }

/**
* JavaScriptCore <= 12 bug
* @see https://bugs.webkit.org/show_bug.cgi?id=171606
*/
const isTypedArrayIndexedPropertyWritable = Object.getOwnPropertyDescriptor(new Uint8Array(1), 0).writable;
/**
* @param {unknown} target

@@ -1239,13 +1233,6 @@ * @returns {number}

get(target, key) {
let wrapper = null;
if (!isTypedArrayIndexedPropertyWritable) {
wrapper = target;
target = _(wrapper).target;
}
if (isStringNumberKey(key)) {
return Reflect.has(target, key) ? convertToNumber(Reflect.get(target, key)) : undefined;
} else {
const ret = wrapper !== null && Reflect.has(wrapper, key) ? Reflect.get(wrapper, key) : Reflect.get(target, key);
const ret = Reflect.get(target, key);

@@ -1268,18 +1255,6 @@ if (typeof ret !== "function") {

set(target, key, value) {
let wrapper = null;
if (!isTypedArrayIndexedPropertyWritable) {
wrapper = target;
target = _(wrapper).target;
}
if (isStringNumberKey(key)) {
return Reflect.set(target, key, roundToFloat16Bits(value));
} else {
// frozen object can't change prototype property
if (wrapper !== null && (!Reflect.has(target, key) || Object.isFrozen(wrapper))) {
return Reflect.set(wrapper, key, value);
} else {
return Reflect.set(target, key, value);
}
return Reflect.set(target, key, value);
}

@@ -1289,45 +1264,2 @@ }

};
if (!isTypedArrayIndexedPropertyWritable) {
handler.getPrototypeOf = wrapper => {
return Reflect.getPrototypeOf(_(wrapper).target);
};
handler.setPrototypeOf = (wrapper, prototype) => {
return Reflect.setPrototypeOf(_(wrapper).target, prototype);
};
handler.defineProperty = (wrapper, key, descriptor) => {
const target = _(wrapper).target;
return !Reflect.has(target, key) || Object.isFrozen(wrapper) ? Reflect.defineProperty(wrapper, key, descriptor) : Reflect.defineProperty(target, key, descriptor);
};
handler.deleteProperty = (wrapper, key) => {
const target = _(wrapper).target;
return Reflect.has(wrapper, key) ? Reflect.deleteProperty(wrapper, key) : Reflect.deleteProperty(target, key);
};
handler.has = (wrapper, key) => {
return Reflect.has(wrapper, key) || Reflect.has(_(wrapper).target, key);
};
handler.isExtensible = wrapper => {
return Reflect.isExtensible(wrapper);
};
handler.preventExtensions = wrapper => {
return Reflect.preventExtensions(wrapper);
};
handler.getOwnPropertyDescriptor = (wrapper, key) => {
return Reflect.getOwnPropertyDescriptor(wrapper, key);
};
handler.ownKeys = wrapper => {
return Reflect.ownKeys(wrapper);
};
}
class Float16Array extends Uint16Array {

@@ -1374,12 +1306,4 @@ constructor(input, byteOffset, length) {

let proxy;
proxy = new Proxy(this, handler); // proxy private storage
if (isTypedArrayIndexedPropertyWritable) {
proxy = new Proxy(this, handler);
} else {
const wrapper = Object.create(null);
_(wrapper).target = this;
proxy = new Proxy(wrapper, handler);
} // proxy private storage
_(proxy).target = this; // this private storage

@@ -1804,4 +1728,6 @@

Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}));

@@ -10,4 +10,2 @@ "use strict";

var _bug = require("./bug");
var _is = require("./is");

@@ -87,13 +85,6 @@

get(target, key) {
let wrapper = null;
if (!_bug.isTypedArrayIndexedPropertyWritable) {
wrapper = target;
target = _(wrapper).target;
}
if ((0, _is.isStringNumberKey)(key)) {
return Reflect.has(target, key) ? (0, _lib.convertToNumber)(Reflect.get(target, key)) : undefined;
} else {
const ret = wrapper !== null && Reflect.has(wrapper, key) ? Reflect.get(wrapper, key) : Reflect.get(target, key);
const ret = Reflect.get(target, key);

@@ -116,18 +107,6 @@ if (typeof ret !== "function") {

set(target, key, value) {
let wrapper = null;
if (!_bug.isTypedArrayIndexedPropertyWritable) {
wrapper = target;
target = _(wrapper).target;
}
if ((0, _is.isStringNumberKey)(key)) {
return Reflect.set(target, key, (0, _lib.roundToFloat16Bits)(value));
} else {
// frozen object can't change prototype property
if (wrapper !== null && (!Reflect.has(target, key) || Object.isFrozen(wrapper))) {
return Reflect.set(wrapper, key, value);
} else {
return Reflect.set(target, key, value);
}
return Reflect.set(target, key, value);
}

@@ -138,44 +117,2 @@ }

if (!_bug.isTypedArrayIndexedPropertyWritable) {
handler.getPrototypeOf = wrapper => {
return Reflect.getPrototypeOf(_(wrapper).target);
};
handler.setPrototypeOf = (wrapper, prototype) => {
return Reflect.setPrototypeOf(_(wrapper).target, prototype);
};
handler.defineProperty = (wrapper, key, descriptor) => {
const target = _(wrapper).target;
return !Reflect.has(target, key) || Object.isFrozen(wrapper) ? Reflect.defineProperty(wrapper, key, descriptor) : Reflect.defineProperty(target, key, descriptor);
};
handler.deleteProperty = (wrapper, key) => {
const target = _(wrapper).target;
return Reflect.has(wrapper, key) ? Reflect.deleteProperty(wrapper, key) : Reflect.deleteProperty(target, key);
};
handler.has = (wrapper, key) => {
return Reflect.has(wrapper, key) || Reflect.has(_(wrapper).target, key);
};
handler.isExtensible = wrapper => {
return Reflect.isExtensible(wrapper);
};
handler.preventExtensions = wrapper => {
return Reflect.preventExtensions(wrapper);
};
handler.getOwnPropertyDescriptor = (wrapper, key) => {
return Reflect.getOwnPropertyDescriptor(wrapper, key);
};
handler.ownKeys = wrapper => {
return Reflect.ownKeys(wrapper);
};
}
class Float16Array extends Uint16Array {

@@ -222,12 +159,4 @@ constructor(input, byteOffset, length) {

let proxy;
proxy = new Proxy(this, handler); // proxy private storage
if (_bug.isTypedArrayIndexedPropertyWritable) {
proxy = new Proxy(this, handler);
} else {
const wrapper = Object.create(null);
_(wrapper).target = this;
proxy = new Proxy(wrapper, handler);
} // proxy private storage
_(proxy).target = this; // this private storage

@@ -234,0 +163,0 @@

{
"name": "@petamoriken/float16",
"description": "half precision floating point for JavaScript",
"version": "2.0.0",
"version": "3.0.0",
"main": "lib/index.js",

@@ -52,2 +52,3 @@ "module": "src/index.js",

"test-browser": "nightwatch -e chrome,chrome_old,firefox,firefox_old,firefox_esr,edge,edge_old,safari,safari_old",
"setup-test-browser": "http-server docs/test -p 8000 > /dev/null 2>&1 &",
"clean": "rm -rf lib browser docs/test/*.css docs/test/*.js docs/test/*.map",

@@ -64,9 +65,10 @@ "refresh": "yarn run clean && yarn run build && yarn run docs",

"babel-plugin-module-resolver": "^4.0.0",
"eslint": "^6.8.0",
"eslint": "^7.4.0",
"eslint-plugin-import": "^2.20.2",
"espower-cli": "^1.1.0",
"exorcist": "^1.0.0",
"exorcist": "^2.0.0",
"http-server": "^0.12.3",
"intelli-espower-loader": "^1.0.1",
"mocha": "^7.0.1",
"nightwatch": "^1.0.18",
"mocha": "^9.0.2",
"nightwatch": "^1.6.4",
"power-assert": "^1.4.2",

@@ -78,3 +80,3 @@ "rollup": "^2.6.0",

"rollup-plugin-node-resolve": "^5.0.0",
"saucelabs": "^4.0.0"
"saucelabs": "^6.0.0"
},

@@ -81,0 +83,0 @@ "dependencies": {

import memoize from "lodash-es/memoize";
import { isTypedArrayIndexedPropertyWritable } from "./bug";
import { isArrayBuffer, isStringNumberKey } from "./is";

@@ -66,12 +65,6 @@ import { convertToNumber, roundToFloat16Bits } from "./lib";

get(target, key) {
let wrapper = null;
if (!isTypedArrayIndexedPropertyWritable) {
wrapper = target;
target = _(wrapper).target;
}
if (isStringNumberKey(key)) {
return Reflect.has(target, key) ? convertToNumber(Reflect.get(target, key)) : undefined;
} else {
const ret = wrapper !== null && Reflect.has(wrapper, key) ? Reflect.get(wrapper, key) : Reflect.get(target, key);
const ret = Reflect.get(target, key);

@@ -94,17 +87,6 @@ if (typeof ret !== "function") {

set(target, key, value) {
let wrapper = null;
if (!isTypedArrayIndexedPropertyWritable) {
wrapper = target;
target = _(wrapper).target;
}
if (isStringNumberKey(key)) {
return Reflect.set(target, key, roundToFloat16Bits(value));
} else {
// frozen object can't change prototype property
if (wrapper !== null && (!Reflect.has(target, key) || Object.isFrozen(wrapper))) {
return Reflect.set(wrapper, key, value);
} else {
return Reflect.set(target, key, value);
}
return Reflect.set(target, key, value);
}

@@ -114,24 +96,2 @@ },

if (!isTypedArrayIndexedPropertyWritable) {
handler.getPrototypeOf = (wrapper) => { return Reflect.getPrototypeOf(_(wrapper).target); };
handler.setPrototypeOf = (wrapper, prototype) => { return Reflect.setPrototypeOf(_(wrapper).target, prototype); };
handler.defineProperty = (wrapper, key, descriptor) => {
const target = _(wrapper).target;
return !Reflect.has(target, key) || Object.isFrozen(wrapper) ? Reflect.defineProperty(wrapper, key, descriptor) : Reflect.defineProperty(target, key, descriptor);
};
handler.deleteProperty = (wrapper, key) => {
const target = _(wrapper).target;
return Reflect.has(wrapper, key) ? Reflect.deleteProperty(wrapper, key) : Reflect.deleteProperty(target, key);
};
handler.has = (wrapper, key) => { return Reflect.has(wrapper, key) || Reflect.has(_(wrapper).target, key); };
handler.isExtensible = (wrapper) => { return Reflect.isExtensible(wrapper); };
handler.preventExtensions = (wrapper) => { return Reflect.preventExtensions(wrapper); };
handler.getOwnPropertyDescriptor = (wrapper, key) => { return Reflect.getOwnPropertyDescriptor(wrapper, key); };
handler.ownKeys = (wrapper) => { return Reflect.ownKeys(wrapper); };
}
export default class Float16Array extends Uint16Array {

@@ -184,9 +144,3 @@

if (isTypedArrayIndexedPropertyWritable) {
proxy = new Proxy(this, handler);
} else {
const wrapper = Object.create(null);
_(wrapper).target = this;
proxy = new Proxy(wrapper, handler);
}
proxy = new Proxy(this, handler);

@@ -193,0 +147,0 @@ // proxy private storage

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