Socket
Socket
Sign inDemoInstall

@petamoriken/float16

Package Overview
Dependencies
0
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.6 to 3.7.0

82

browser/float16.js

@@ -1,4 +0,4 @@

/*! @petamoriken/float16 v3.6.6 | MIT License - https://github.com/petamoriken/float16 */
/*! @petamoriken/float16 v3.7.0 | MIT License - https://github.com/petamoriken/float16 */
const float16 = (function (exports) {
var float16 = (function (exports) {
'use strict';

@@ -25,2 +25,4 @@

"Reduce of empty array with no initial value";
const THE_COMPARISON_FUNCTION_MUST_BE_EITHER_A_FUNCTION_OR_UNDEFINED =
"The comparison function must be either a function or undefined";
const OFFSET_IS_OUT_OF_BOUNDS = "Offset is out of bounds";

@@ -55,3 +57,3 @@

const {
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
MAX_SAFE_INTEGER,
isFinite: NumberIsFinite,

@@ -587,8 +589,2 @@ isNaN: NumberIsNaN,

const buffer = TypedArrayPrototypeGetBuffer(input);
const BufferConstructor = !isSharedArrayBuffer(buffer)
? (SpeciesConstructor(
buffer,
NativeArrayBuffer
))
: NativeArrayBuffer;
if (IsDetachedBuffer(buffer)) {

@@ -600,3 +596,3 @@ throw NativeTypeError(ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);

}
const data = new BufferConstructor(
const data = new NativeArrayBuffer(
length * BYTES_PER_ELEMENT

@@ -768,2 +764,26 @@ );

}
with(index, value) {
assertFloat16Array(this);
const float16bitsArray = getFloat16BitsArray(this);
const length = TypedArrayPrototypeGetLength(float16bitsArray);
const relativeIndex = ToIntegerOrInfinity(index);
const k = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
const number = +value;
if (k < 0 || k >= length) {
throw NativeRangeError(OFFSET_IS_OUT_OF_BOUNDS);
}
const uint16 = new NativeUint16Array(
TypedArrayPrototypeGetBuffer(float16bitsArray),
TypedArrayPrototypeGetByteOffset(float16bitsArray),
TypedArrayPrototypeGetLength(float16bitsArray)
);
const cloned = new Float16Array(
TypedArrayPrototypeGetBuffer(
TypedArrayPrototypeSlice(uint16)
)
);
const array = getFloat16BitsArray(cloned);
array[k] = roundToFloat16Bits(number);
return cloned;
}
map(callback, ...opts) {

@@ -1006,2 +1026,19 @@ assertFloat16Array(this);

}
toReversed() {
assertFloat16Array(this);
const float16bitsArray = getFloat16BitsArray(this);
const uint16 = new NativeUint16Array(
TypedArrayPrototypeGetBuffer(float16bitsArray),
TypedArrayPrototypeGetByteOffset(float16bitsArray),
TypedArrayPrototypeGetLength(float16bitsArray)
);
const cloned = new Float16Array(
TypedArrayPrototypeGetBuffer(
TypedArrayPrototypeSlice(uint16)
)
);
const clonedFloat16bitsArray = getFloat16BitsArray(cloned);
TypedArrayPrototypeReverse(clonedFloat16bitsArray);
return cloned;
}
fill(value, ...opts) {

@@ -1032,2 +1069,25 @@ assertFloat16Array(this);

}
toSorted(compareFn) {
assertFloat16Array(this);
const float16bitsArray = getFloat16BitsArray(this);
if (compareFn !== undefined && typeof compareFn !== "function") {
throw new NativeTypeError(THE_COMPARISON_FUNCTION_MUST_BE_EITHER_A_FUNCTION_OR_UNDEFINED);
}
const sortCompare = compareFn !== undefined ? compareFn : defaultCompare;
const uint16 = new NativeUint16Array(
TypedArrayPrototypeGetBuffer(float16bitsArray),
TypedArrayPrototypeGetByteOffset(float16bitsArray),
TypedArrayPrototypeGetLength(float16bitsArray)
);
const cloned = new Float16Array(
TypedArrayPrototypeGetBuffer(
TypedArrayPrototypeSlice(uint16)
)
);
const clonedFloat16bitsArray = getFloat16BitsArray(cloned);
TypedArrayPrototypeSort(clonedFloat16bitsArray, (x, y) => {
return sortCompare(convertToNumber(x), convertToNumber(y));
});
return cloned;
}
slice(start, end) {

@@ -1245,3 +1305,3 @@ assertFloat16Array(this);

Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

@@ -1248,0 +1308,0 @@ return exports;

@@ -334,2 +334,22 @@ /**

/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Float16Array;
/**
* Copies and sorts the array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending.
*/
toSorted(compareFn?: (a: number, b: number) => number): Float16Array;
/**
* Copies the array and replaces the element at the given index with the provided value.
* @param index The zero-based location in the array for which to replace an element.
* @param value Element to insert into the array in place of the replaced element.
*/
with(index: number, value: number): Float16Array;
/**
* Converts a number to a string by using the current locale.

@@ -336,0 +356,0 @@ */

28

package.json
{
"name": "@petamoriken/float16",
"version": "3.6.6",
"version": "3.7.0",
"description": "IEEE 754 half-precision floating-point for JavaScript",

@@ -75,23 +75,23 @@ "keywords": [

"devDependencies": {
"@babel/cli": "^7.18.9",
"@babel/core": "^7.18.9",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@types/nightwatch": "^2.0.9",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.20.5",
"@babel/plugin-transform-modules-commonjs": "^7.19.6",
"@types/nightwatch": "^2.3.15",
"babel-plugin-replace-import-extension": "^1.1.3",
"browserslist": "^4.21.2",
"concurrently": "^7.3.0",
"eslint": "^8.20.0",
"browserslist": "^4.21.4",
"concurrently": "^7.6.0",
"eslint": "^8.29.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.3",
"eslint-plugin-jsdoc": "^39.6.4",
"espower-cli": "^1.1.0",
"espower-loader": "^1.2.2",
"exorcist": "^2.0.0",
"find-unused-exports": "^3.0.0",
"find-unused-exports": "^5.0.0",
"http-server": "^14.1.1",
"mocha": "^10.0.0",
"nightwatch": "^2.2.3",
"nightwatch-saucelabs-endsauce": "^1.2.1",
"mocha": "^10.1.0",
"nightwatch": "^2.5.3",
"nightwatch-saucelabs-endsauce": "^2.1.0",
"nyc": "^15.1.0",
"power-assert": "^1.4.2",
"rollup": "^2.77.0",
"rollup": "^3.6.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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc