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.4.1 to 3.4.2

34

browser/float16.js

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

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

@@ -263,2 +263,20 @@ var float16 = (function (exports) {

* @param {unknown} value
* @returns {value is any[]}
*/
function isOrdinaryArray(value) {
if (!Array.isArray(value)) {
return false;
}
const iterator = value[Symbol.iterator]();
if (toString.call(iterator) !== "[object Array Iterator]") {
return false;
}
return true;
}
/**
* @param {unknown} value
* @returns {value is string}

@@ -584,5 +602,13 @@ */

} else if (isIterable(input)) {
list = [...input];
length = list.length;
super(length); // ArrayLike
// for optimization
if (isOrdinaryArray(input)) {
list = input;
length = input.length;
super(length);
} else {
list = [...input];
length = list.length;
super(length);
} // ArrayLike
} else {

@@ -589,0 +615,0 @@ list = input;

70

index.d.ts

@@ -44,5 +44,4 @@ /**

/**
* Returns a value in the array
* @param index If index is negative, it is treated as length+index where length is the
* length of the array.
* Access item by relative indexing.
* @param index index to access.
*/

@@ -84,8 +83,8 @@ at(index: number): number;

* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Float16Array) => any, thisArg?: any): Float16Array;
filter(predicate: (value: number, index: number, array: Float16Array) => any, thisArg?: any): Float16Array;

@@ -123,14 +122,14 @@ /**

*/
findLast(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number | undefined;
findLast(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number;

@@ -244,3 +243,3 @@ /**

*/
reverse(): Float16Array;
reverse(): this;

@@ -305,6 +304,8 @@ /**

export declare var Float16Array: {
export interface Float16ArrayConstructor {
readonly prototype: Float16Array;
new(): Float16Array;
new(length: number): Float16Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Float16Array;
new(elements: Iterable<number>): Float16Array;
new(array: ArrayLike<number> | ArrayBufferLike): Float16Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Float16Array;

@@ -327,2 +328,16 @@

*/
from(arrayLike: Iterable<number>): Float16Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Float16Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
*/
from(arrayLike: ArrayLike<number>): Float16Array;

@@ -338,2 +353,3 @@

}
export declare var Float16Array: Float16ArrayConstructor;

@@ -347,8 +363,8 @@ /**

/**
* Gets the Float16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read,
* otherwise a little-endian value should be read.
*/
* Gets the Float16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read,
* otherwise a little-endian value should be read.
*/
export declare function getFloat16(dataView: DataView, byteOffset: number, littleEndian?: boolean): number;

@@ -355,0 +371,0 @@

@@ -193,5 +193,13 @@ "use strict";

} else if ((0, _is.isIterable)(input)) {
list = [...input];
length = list.length;
super(length); // ArrayLike
// for optimization
if ((0, _is.isOrdinaryArray)(input)) {
list = input;
length = input.length;
super(length);
} else {
list = [...input];
length = list.length;
super(length);
} // ArrayLike
} else {

@@ -198,0 +206,0 @@ list = input;

@@ -14,2 +14,3 @@ "use strict";

exports.isIterable = isIterable;
exports.isOrdinaryArray = isOrdinaryArray;
exports.isCanonicalIntegerIndexString = isCanonicalIntegerIndexString;

@@ -105,2 +106,21 @@

* @param {unknown} value
* @returns {value is any[]}
*/
function isOrdinaryArray(value) {
if (!Array.isArray(value)) {
return false;
}
const iterator = value[Symbol.iterator]();
if (toString.call(iterator) !== "[object Array Iterator]") {
return false;
}
return true;
}
/**
* @param {unknown} value
* @returns {value is string}

@@ -107,0 +127,0 @@ */

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

@@ -6,0 +6,0 @@ "module": "./index.mjs",

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