This commit is contained in:
52
node_modules/@petamoriken/float16/lib/_util/arrayIterator.cjs
generated
vendored
Normal file
52
node_modules/@petamoriken/float16/lib/_util/arrayIterator.cjs
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.safeIfNeeded = safeIfNeeded;
|
||||
exports.wrap = wrap;
|
||||
var _primordials = require("./primordials.cjs");
|
||||
const arrayIterators = new _primordials.NativeWeakMap();
|
||||
const SafeIteratorPrototype = (0, _primordials.ObjectCreate)(null, {
|
||||
next: {
|
||||
value: function next() {
|
||||
const arrayIterator = (0, _primordials.WeakMapPrototypeGet)(arrayIterators, this);
|
||||
return (0, _primordials.ArrayIteratorPrototypeNext)(arrayIterator);
|
||||
}
|
||||
},
|
||||
[_primordials.SymbolIterator]: {
|
||||
value: function values() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
});
|
||||
function safeIfNeeded(array) {
|
||||
if (array[_primordials.SymbolIterator] === _primordials.NativeArrayPrototypeSymbolIterator && _primordials.ArrayIteratorPrototype.next === _primordials.ArrayIteratorPrototypeNext) {
|
||||
return array;
|
||||
}
|
||||
const safe = (0, _primordials.ObjectCreate)(SafeIteratorPrototype);
|
||||
(0, _primordials.WeakMapPrototypeSet)(arrayIterators, safe, (0, _primordials.ArrayPrototypeSymbolIterator)(array));
|
||||
return safe;
|
||||
}
|
||||
const generators = new _primordials.NativeWeakMap();
|
||||
const DummyArrayIteratorPrototype = (0, _primordials.ObjectCreate)(_primordials.IteratorPrototype, {
|
||||
next: {
|
||||
value: function next() {
|
||||
const generator = (0, _primordials.WeakMapPrototypeGet)(generators, this);
|
||||
return (0, _primordials.GeneratorPrototypeNext)(generator);
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
for (const key of (0, _primordials.ReflectOwnKeys)(_primordials.ArrayIteratorPrototype)) {
|
||||
if (key === "next") {
|
||||
continue;
|
||||
}
|
||||
(0, _primordials.ObjectDefineProperty)(DummyArrayIteratorPrototype, key, (0, _primordials.ReflectGetOwnPropertyDescriptor)(_primordials.ArrayIteratorPrototype, key));
|
||||
}
|
||||
function wrap(generator) {
|
||||
const dummy = (0, _primordials.ObjectCreate)(DummyArrayIteratorPrototype);
|
||||
(0, _primordials.WeakMapPrototypeSet)(generators, dummy, generator);
|
||||
return dummy;
|
||||
}
|
||||
27
node_modules/@petamoriken/float16/lib/_util/brand.cjs
generated
vendored
Normal file
27
node_modules/@petamoriken/float16/lib/_util/brand.cjs
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasFloat16ArrayBrand = hasFloat16ArrayBrand;
|
||||
var _is = require("./is.cjs");
|
||||
var _messages = require("./messages.cjs");
|
||||
var _primordials = require("./primordials.cjs");
|
||||
const brand = exports.brand = (0, _primordials.SymbolFor)("__Float16Array__");
|
||||
function hasFloat16ArrayBrand(target) {
|
||||
if (!(0, _is.isObjectLike)(target)) {
|
||||
return false;
|
||||
}
|
||||
const prototype = (0, _primordials.ReflectGetPrototypeOf)(target);
|
||||
if (!(0, _is.isObjectLike)(prototype)) {
|
||||
return false;
|
||||
}
|
||||
const constructor = prototype.constructor;
|
||||
if (constructor === undefined) {
|
||||
return false;
|
||||
}
|
||||
if (!(0, _is.isObject)(constructor)) {
|
||||
throw (0, _primordials.NativeTypeError)(_messages.THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
return (0, _primordials.ReflectHas)(constructor, brand);
|
||||
}
|
||||
111
node_modules/@petamoriken/float16/lib/_util/converter.cjs
generated
vendored
Normal file
111
node_modules/@petamoriken/float16/lib/_util/converter.cjs
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.convertToNumber = convertToNumber;
|
||||
exports.roundToFloat16 = roundToFloat16;
|
||||
exports.roundToFloat16Bits = roundToFloat16Bits;
|
||||
var _primordials = require("./primordials.cjs");
|
||||
const INVERSE_OF_EPSILON = 1 / _primordials.EPSILON;
|
||||
function roundTiesToEven(num) {
|
||||
return num + INVERSE_OF_EPSILON - INVERSE_OF_EPSILON;
|
||||
}
|
||||
const FLOAT16_MIN_VALUE = 6.103515625e-05;
|
||||
const FLOAT16_MAX_VALUE = 65504;
|
||||
const FLOAT16_EPSILON = 0.0009765625;
|
||||
const FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE = FLOAT16_EPSILON * FLOAT16_MIN_VALUE;
|
||||
const FLOAT16_EPSILON_DEVIDED_BY_EPSILON = FLOAT16_EPSILON * INVERSE_OF_EPSILON;
|
||||
function roundToFloat16(num) {
|
||||
const number = +num;
|
||||
if (!(0, _primordials.NumberIsFinite)(number) || number === 0) {
|
||||
return number;
|
||||
}
|
||||
const sign = number > 0 ? 1 : -1;
|
||||
const absolute = (0, _primordials.MathAbs)(number);
|
||||
if (absolute < FLOAT16_MIN_VALUE) {
|
||||
return sign * roundTiesToEven(absolute / FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE) * FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE;
|
||||
}
|
||||
const temp = (1 + FLOAT16_EPSILON_DEVIDED_BY_EPSILON) * absolute;
|
||||
const result = temp - (temp - absolute);
|
||||
if (result > FLOAT16_MAX_VALUE || (0, _primordials.NumberIsNaN)(result)) {
|
||||
return sign * Infinity;
|
||||
}
|
||||
return sign * result;
|
||||
}
|
||||
const buffer = new _primordials.NativeArrayBuffer(4);
|
||||
const floatView = new _primordials.NativeFloat32Array(buffer);
|
||||
const uint32View = new _primordials.NativeUint32Array(buffer);
|
||||
const baseTable = new _primordials.NativeUint16Array(512);
|
||||
const shiftTable = new _primordials.NativeUint8Array(512);
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
const e = i - 127;
|
||||
if (e < -24) {
|
||||
baseTable[i] = 0x0000;
|
||||
baseTable[i | 0x100] = 0x8000;
|
||||
shiftTable[i] = 24;
|
||||
shiftTable[i | 0x100] = 24;
|
||||
} else if (e < -14) {
|
||||
baseTable[i] = 0x0400 >> -e - 14;
|
||||
baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
||||
shiftTable[i] = -e - 1;
|
||||
shiftTable[i | 0x100] = -e - 1;
|
||||
} else if (e <= 15) {
|
||||
baseTable[i] = e + 15 << 10;
|
||||
baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
||||
shiftTable[i] = 13;
|
||||
shiftTable[i | 0x100] = 13;
|
||||
} else if (e < 128) {
|
||||
baseTable[i] = 0x7c00;
|
||||
baseTable[i | 0x100] = 0xfc00;
|
||||
shiftTable[i] = 24;
|
||||
shiftTable[i | 0x100] = 24;
|
||||
} else {
|
||||
baseTable[i] = 0x7c00;
|
||||
baseTable[i | 0x100] = 0xfc00;
|
||||
shiftTable[i] = 13;
|
||||
shiftTable[i | 0x100] = 13;
|
||||
}
|
||||
}
|
||||
function roundToFloat16Bits(num) {
|
||||
floatView[0] = roundToFloat16(num);
|
||||
const f = uint32View[0];
|
||||
const e = f >> 23 & 0x1ff;
|
||||
return baseTable[e] + ((f & 0x007fffff) >> shiftTable[e]);
|
||||
}
|
||||
const mantissaTable = new _primordials.NativeUint32Array(2048);
|
||||
for (let i = 1; i < 1024; ++i) {
|
||||
let m = i << 13;
|
||||
let e = 0;
|
||||
while ((m & 0x00800000) === 0) {
|
||||
m <<= 1;
|
||||
e -= 0x00800000;
|
||||
}
|
||||
m &= ~0x00800000;
|
||||
e += 0x38800000;
|
||||
mantissaTable[i] = m | e;
|
||||
}
|
||||
for (let i = 1024; i < 2048; ++i) {
|
||||
mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
|
||||
}
|
||||
const exponentTable = new _primordials.NativeUint32Array(64);
|
||||
for (let i = 1; i < 31; ++i) {
|
||||
exponentTable[i] = i << 23;
|
||||
}
|
||||
exponentTable[31] = 0x47800000;
|
||||
exponentTable[32] = 0x80000000;
|
||||
for (let i = 33; i < 63; ++i) {
|
||||
exponentTable[i] = 0x80000000 + (i - 32 << 23);
|
||||
}
|
||||
exponentTable[63] = 0xc7800000;
|
||||
const offsetTable = new _primordials.NativeUint16Array(64);
|
||||
for (let i = 1; i < 64; ++i) {
|
||||
if (i !== 32) {
|
||||
offsetTable[i] = 1024;
|
||||
}
|
||||
}
|
||||
function convertToNumber(float16bits) {
|
||||
const i = float16bits >> 10;
|
||||
uint32View[0] = mantissaTable[offsetTable[i] + (float16bits & 0x3ff)] + exponentTable[i];
|
||||
return floatView[0];
|
||||
}
|
||||
78
node_modules/@petamoriken/float16/lib/_util/is.cjs
generated
vendored
Normal file
78
node_modules/@petamoriken/float16/lib/_util/is.cjs
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
||||
exports.isCanonicalIntegerIndexString = isCanonicalIntegerIndexString;
|
||||
exports.isNativeBigIntTypedArray = isNativeBigIntTypedArray;
|
||||
exports.isNativeTypedArray = isNativeTypedArray;
|
||||
exports.isObject = isObject;
|
||||
exports.isObjectLike = isObjectLike;
|
||||
exports.isOrdinaryArray = isOrdinaryArray;
|
||||
exports.isOrdinaryNativeTypedArray = isOrdinaryNativeTypedArray;
|
||||
exports.isSharedArrayBuffer = isSharedArrayBuffer;
|
||||
var _primordials = require("./primordials.cjs");
|
||||
function isObject(value) {
|
||||
return value !== null && typeof value === "object" || typeof value === "function";
|
||||
}
|
||||
function isObjectLike(value) {
|
||||
return value !== null && typeof value === "object";
|
||||
}
|
||||
function isNativeTypedArray(value) {
|
||||
return (0, _primordials.TypedArrayPrototypeGetSymbolToStringTag)(value) !== undefined;
|
||||
}
|
||||
function isNativeBigIntTypedArray(value) {
|
||||
const typedArrayName = (0, _primordials.TypedArrayPrototypeGetSymbolToStringTag)(value);
|
||||
return typedArrayName === "BigInt64Array" || typedArrayName === "BigUint64Array";
|
||||
}
|
||||
function isArrayBuffer(value) {
|
||||
try {
|
||||
if ((0, _primordials.ArrayIsArray)(value)) {
|
||||
return false;
|
||||
}
|
||||
(0, _primordials.ArrayBufferPrototypeGetByteLength)(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function isSharedArrayBuffer(value) {
|
||||
if (_primordials.NativeSharedArrayBuffer === null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
(0, _primordials.SharedArrayBufferPrototypeGetByteLength)(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function isAnyArrayBuffer(value) {
|
||||
return isArrayBuffer(value) || isSharedArrayBuffer(value);
|
||||
}
|
||||
function isOrdinaryArray(value) {
|
||||
if (!(0, _primordials.ArrayIsArray)(value)) {
|
||||
return false;
|
||||
}
|
||||
return value[_primordials.SymbolIterator] === _primordials.NativeArrayPrototypeSymbolIterator && _primordials.ArrayIteratorPrototype.next === _primordials.ArrayIteratorPrototypeNext;
|
||||
}
|
||||
function isOrdinaryNativeTypedArray(value) {
|
||||
if (!isNativeTypedArray(value)) {
|
||||
return false;
|
||||
}
|
||||
return value[_primordials.SymbolIterator] === _primordials.NativeTypedArrayPrototypeSymbolIterator && _primordials.ArrayIteratorPrototype.next === _primordials.ArrayIteratorPrototypeNext;
|
||||
}
|
||||
function isCanonicalIntegerIndexString(value) {
|
||||
if (typeof value !== "string") {
|
||||
return false;
|
||||
}
|
||||
const number = +value;
|
||||
if (value !== number + "") {
|
||||
return false;
|
||||
}
|
||||
if (!(0, _primordials.NumberIsFinite)(number)) {
|
||||
return false;
|
||||
}
|
||||
return number === (0, _primordials.MathTrunc)(number);
|
||||
}
|
||||
18
node_modules/@petamoriken/float16/lib/_util/messages.cjs
generated
vendored
Normal file
18
node_modules/@petamoriken/float16/lib/_util/messages.cjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const THIS_IS_NOT_AN_OBJECT = exports.THIS_IS_NOT_AN_OBJECT = "This is not an object";
|
||||
const THIS_IS_NOT_A_FLOAT16ARRAY_OBJECT = exports.THIS_IS_NOT_A_FLOAT16ARRAY_OBJECT = "This is not a Float16Array object";
|
||||
const THIS_CONSTRUCTOR_IS_NOT_A_SUBCLASS_OF_FLOAT16ARRAY = exports.THIS_CONSTRUCTOR_IS_NOT_A_SUBCLASS_OF_FLOAT16ARRAY = "This constructor is not a subclass of Float16Array";
|
||||
const THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT = exports.THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT = "The constructor property value is not an object";
|
||||
const SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT = exports.SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT = "Species constructor didn't return TypedArray object";
|
||||
const DERIVED_CONSTRUCTOR_CREATED_TYPEDARRAY_OBJECT_WHICH_WAS_TOO_SMALL_LENGTH = exports.DERIVED_CONSTRUCTOR_CREATED_TYPEDARRAY_OBJECT_WHICH_WAS_TOO_SMALL_LENGTH = "Derived constructor created TypedArray object which was too small length";
|
||||
const ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER = exports.ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER = "Attempting to access detached ArrayBuffer";
|
||||
const CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT = exports.CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT = "Cannot convert undefined or null to object";
|
||||
const CANNOT_MIX_BIGINT_AND_OTHER_TYPES = exports.CANNOT_MIX_BIGINT_AND_OTHER_TYPES = "Cannot mix BigInt and other types, use explicit conversions";
|
||||
const ITERATOR_PROPERTY_IS_NOT_CALLABLE = exports.ITERATOR_PROPERTY_IS_NOT_CALLABLE = "@@iterator property is not callable";
|
||||
const REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE = exports.REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE = "Reduce of empty array with no initial value";
|
||||
const THE_COMPARISON_FUNCTION_MUST_BE_EITHER_A_FUNCTION_OR_UNDEFINED = exports.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 = exports.OFFSET_IS_OUT_OF_BOUNDS = "Offset is out of bounds";
|
||||
150
node_modules/@petamoriken/float16/lib/_util/primordials.cjs
generated
vendored
Normal file
150
node_modules/@petamoriken/float16/lib/_util/primordials.cjs
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _messages = require("./messages.cjs");
|
||||
function uncurryThis(target) {
|
||||
return (thisArg, ...args) => {
|
||||
return ReflectApply(target, thisArg, args);
|
||||
};
|
||||
}
|
||||
function uncurryThisGetter(target, key) {
|
||||
return uncurryThis(ReflectGetOwnPropertyDescriptor(target, key).get);
|
||||
}
|
||||
const {
|
||||
apply: ReflectApply,
|
||||
construct: ReflectConstruct,
|
||||
defineProperty: ReflectDefineProperty,
|
||||
get: ReflectGet,
|
||||
getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor,
|
||||
getPrototypeOf: ReflectGetPrototypeOf,
|
||||
has: ReflectHas,
|
||||
ownKeys: ReflectOwnKeys,
|
||||
set: ReflectSet,
|
||||
setPrototypeOf: ReflectSetPrototypeOf
|
||||
} = Reflect;
|
||||
exports.ReflectSetPrototypeOf = ReflectSetPrototypeOf;
|
||||
exports.ReflectSet = ReflectSet;
|
||||
exports.ReflectOwnKeys = ReflectOwnKeys;
|
||||
exports.ReflectHas = ReflectHas;
|
||||
exports.ReflectGetPrototypeOf = ReflectGetPrototypeOf;
|
||||
exports.ReflectGetOwnPropertyDescriptor = ReflectGetOwnPropertyDescriptor;
|
||||
exports.ReflectGet = ReflectGet;
|
||||
exports.ReflectDefineProperty = ReflectDefineProperty;
|
||||
exports.ReflectConstruct = ReflectConstruct;
|
||||
exports.ReflectApply = ReflectApply;
|
||||
const NativeProxy = exports.NativeProxy = Proxy;
|
||||
const {
|
||||
EPSILON,
|
||||
MAX_SAFE_INTEGER,
|
||||
isFinite: NumberIsFinite,
|
||||
isNaN: NumberIsNaN
|
||||
} = Number;
|
||||
exports.NumberIsNaN = NumberIsNaN;
|
||||
exports.NumberIsFinite = NumberIsFinite;
|
||||
exports.MAX_SAFE_INTEGER = MAX_SAFE_INTEGER;
|
||||
exports.EPSILON = EPSILON;
|
||||
const {
|
||||
iterator: SymbolIterator,
|
||||
species: SymbolSpecies,
|
||||
toStringTag: SymbolToStringTag,
|
||||
for: SymbolFor
|
||||
} = Symbol;
|
||||
exports.SymbolFor = SymbolFor;
|
||||
exports.SymbolToStringTag = SymbolToStringTag;
|
||||
exports.SymbolSpecies = SymbolSpecies;
|
||||
exports.SymbolIterator = SymbolIterator;
|
||||
const NativeObject = exports.NativeObject = Object;
|
||||
const {
|
||||
create: ObjectCreate,
|
||||
defineProperty: ObjectDefineProperty,
|
||||
freeze: ObjectFreeze,
|
||||
is: ObjectIs
|
||||
} = NativeObject;
|
||||
exports.ObjectIs = ObjectIs;
|
||||
exports.ObjectFreeze = ObjectFreeze;
|
||||
exports.ObjectDefineProperty = ObjectDefineProperty;
|
||||
exports.ObjectCreate = ObjectCreate;
|
||||
const ObjectPrototype = NativeObject.prototype;
|
||||
const ObjectPrototype__lookupGetter__ = exports.ObjectPrototype__lookupGetter__ = ObjectPrototype.__lookupGetter__ ? uncurryThis(ObjectPrototype.__lookupGetter__) : (object, key) => {
|
||||
if (object == null) {
|
||||
throw NativeTypeError(_messages.CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT);
|
||||
}
|
||||
let target = NativeObject(object);
|
||||
do {
|
||||
const descriptor = ReflectGetOwnPropertyDescriptor(target, key);
|
||||
if (descriptor !== undefined) {
|
||||
if (ObjectHasOwn(descriptor, "get")) {
|
||||
return descriptor.get;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} while ((target = ReflectGetPrototypeOf(target)) !== null);
|
||||
};
|
||||
const ObjectHasOwn = exports.ObjectHasOwn = NativeObject.hasOwn || uncurryThis(ObjectPrototype.hasOwnProperty);
|
||||
const NativeArray = Array;
|
||||
const ArrayIsArray = exports.ArrayIsArray = NativeArray.isArray;
|
||||
const ArrayPrototype = NativeArray.prototype;
|
||||
const ArrayPrototypeJoin = exports.ArrayPrototypeJoin = uncurryThis(ArrayPrototype.join);
|
||||
const ArrayPrototypePush = exports.ArrayPrototypePush = uncurryThis(ArrayPrototype.push);
|
||||
const ArrayPrototypeToLocaleString = exports.ArrayPrototypeToLocaleString = uncurryThis(ArrayPrototype.toLocaleString);
|
||||
const NativeArrayPrototypeSymbolIterator = exports.NativeArrayPrototypeSymbolIterator = ArrayPrototype[SymbolIterator];
|
||||
const ArrayPrototypeSymbolIterator = exports.ArrayPrototypeSymbolIterator = uncurryThis(NativeArrayPrototypeSymbolIterator);
|
||||
const {
|
||||
abs: MathAbs,
|
||||
trunc: MathTrunc
|
||||
} = Math;
|
||||
exports.MathTrunc = MathTrunc;
|
||||
exports.MathAbs = MathAbs;
|
||||
const NativeArrayBuffer = exports.NativeArrayBuffer = ArrayBuffer;
|
||||
const ArrayBufferIsView = exports.ArrayBufferIsView = NativeArrayBuffer.isView;
|
||||
const ArrayBufferPrototype = NativeArrayBuffer.prototype;
|
||||
const ArrayBufferPrototypeSlice = exports.ArrayBufferPrototypeSlice = uncurryThis(ArrayBufferPrototype.slice);
|
||||
const ArrayBufferPrototypeGetByteLength = exports.ArrayBufferPrototypeGetByteLength = uncurryThisGetter(ArrayBufferPrototype, "byteLength");
|
||||
const NativeSharedArrayBuffer = exports.NativeSharedArrayBuffer = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : null;
|
||||
const SharedArrayBufferPrototypeGetByteLength = exports.SharedArrayBufferPrototypeGetByteLength = NativeSharedArrayBuffer && uncurryThisGetter(NativeSharedArrayBuffer.prototype, "byteLength");
|
||||
const TypedArray = exports.TypedArray = ReflectGetPrototypeOf(Uint8Array);
|
||||
const TypedArrayFrom = TypedArray.from;
|
||||
const TypedArrayPrototype = exports.TypedArrayPrototype = TypedArray.prototype;
|
||||
const NativeTypedArrayPrototypeSymbolIterator = exports.NativeTypedArrayPrototypeSymbolIterator = TypedArrayPrototype[SymbolIterator];
|
||||
const TypedArrayPrototypeKeys = exports.TypedArrayPrototypeKeys = uncurryThis(TypedArrayPrototype.keys);
|
||||
const TypedArrayPrototypeValues = exports.TypedArrayPrototypeValues = uncurryThis(TypedArrayPrototype.values);
|
||||
const TypedArrayPrototypeEntries = exports.TypedArrayPrototypeEntries = uncurryThis(TypedArrayPrototype.entries);
|
||||
const TypedArrayPrototypeSet = exports.TypedArrayPrototypeSet = uncurryThis(TypedArrayPrototype.set);
|
||||
const TypedArrayPrototypeReverse = exports.TypedArrayPrototypeReverse = uncurryThis(TypedArrayPrototype.reverse);
|
||||
const TypedArrayPrototypeFill = exports.TypedArrayPrototypeFill = uncurryThis(TypedArrayPrototype.fill);
|
||||
const TypedArrayPrototypeCopyWithin = exports.TypedArrayPrototypeCopyWithin = uncurryThis(TypedArrayPrototype.copyWithin);
|
||||
const TypedArrayPrototypeSort = exports.TypedArrayPrototypeSort = uncurryThis(TypedArrayPrototype.sort);
|
||||
const TypedArrayPrototypeSlice = exports.TypedArrayPrototypeSlice = uncurryThis(TypedArrayPrototype.slice);
|
||||
const TypedArrayPrototypeSubarray = exports.TypedArrayPrototypeSubarray = uncurryThis(TypedArrayPrototype.subarray);
|
||||
const TypedArrayPrototypeGetBuffer = exports.TypedArrayPrototypeGetBuffer = uncurryThisGetter(TypedArrayPrototype, "buffer");
|
||||
const TypedArrayPrototypeGetByteOffset = exports.TypedArrayPrototypeGetByteOffset = uncurryThisGetter(TypedArrayPrototype, "byteOffset");
|
||||
const TypedArrayPrototypeGetLength = exports.TypedArrayPrototypeGetLength = uncurryThisGetter(TypedArrayPrototype, "length");
|
||||
const TypedArrayPrototypeGetSymbolToStringTag = exports.TypedArrayPrototypeGetSymbolToStringTag = uncurryThisGetter(TypedArrayPrototype, SymbolToStringTag);
|
||||
const NativeUint8Array = exports.NativeUint8Array = Uint8Array;
|
||||
const NativeUint16Array = exports.NativeUint16Array = Uint16Array;
|
||||
const Uint16ArrayFrom = (...args) => {
|
||||
return ReflectApply(TypedArrayFrom, NativeUint16Array, args);
|
||||
};
|
||||
exports.Uint16ArrayFrom = Uint16ArrayFrom;
|
||||
const NativeUint32Array = exports.NativeUint32Array = Uint32Array;
|
||||
const NativeFloat32Array = exports.NativeFloat32Array = Float32Array;
|
||||
const ArrayIteratorPrototype = exports.ArrayIteratorPrototype = ReflectGetPrototypeOf([][SymbolIterator]());
|
||||
const ArrayIteratorPrototypeNext = exports.ArrayIteratorPrototypeNext = uncurryThis(ArrayIteratorPrototype.next);
|
||||
const GeneratorPrototypeNext = exports.GeneratorPrototypeNext = uncurryThis(function* () {}().next);
|
||||
const IteratorPrototype = exports.IteratorPrototype = ReflectGetPrototypeOf(ArrayIteratorPrototype);
|
||||
const DataViewPrototype = DataView.prototype;
|
||||
const DataViewPrototypeGetUint16 = exports.DataViewPrototypeGetUint16 = uncurryThis(DataViewPrototype.getUint16);
|
||||
const DataViewPrototypeSetUint16 = exports.DataViewPrototypeSetUint16 = uncurryThis(DataViewPrototype.setUint16);
|
||||
const NativeTypeError = exports.NativeTypeError = TypeError;
|
||||
const NativeRangeError = exports.NativeRangeError = RangeError;
|
||||
const NativeWeakSet = exports.NativeWeakSet = WeakSet;
|
||||
const WeakSetPrototype = NativeWeakSet.prototype;
|
||||
const WeakSetPrototypeAdd = exports.WeakSetPrototypeAdd = uncurryThis(WeakSetPrototype.add);
|
||||
const WeakSetPrototypeHas = exports.WeakSetPrototypeHas = uncurryThis(WeakSetPrototype.has);
|
||||
const NativeWeakMap = exports.NativeWeakMap = WeakMap;
|
||||
const WeakMapPrototype = NativeWeakMap.prototype;
|
||||
const WeakMapPrototypeGet = exports.WeakMapPrototypeGet = uncurryThis(WeakMapPrototype.get);
|
||||
const WeakMapPrototypeHas = exports.WeakMapPrototypeHas = uncurryThis(WeakMapPrototype.has);
|
||||
const WeakMapPrototypeSet = exports.WeakMapPrototypeSet = uncurryThis(WeakMapPrototype.set);
|
||||
84
node_modules/@petamoriken/float16/lib/_util/spec.cjs
generated
vendored
Normal file
84
node_modules/@petamoriken/float16/lib/_util/spec.cjs
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.IsDetachedBuffer = IsDetachedBuffer;
|
||||
exports.SpeciesConstructor = SpeciesConstructor;
|
||||
exports.ToIntegerOrInfinity = ToIntegerOrInfinity;
|
||||
exports.ToLength = ToLength;
|
||||
exports.defaultCompare = defaultCompare;
|
||||
var _is = require("./is.cjs");
|
||||
var _messages = require("./messages.cjs");
|
||||
var _primordials = require("./primordials.cjs");
|
||||
function ToIntegerOrInfinity(target) {
|
||||
const number = +target;
|
||||
if ((0, _primordials.NumberIsNaN)(number) || number === 0) {
|
||||
return 0;
|
||||
}
|
||||
return (0, _primordials.MathTrunc)(number);
|
||||
}
|
||||
function ToLength(target) {
|
||||
const length = ToIntegerOrInfinity(target);
|
||||
if (length < 0) {
|
||||
return 0;
|
||||
}
|
||||
return length < _primordials.MAX_SAFE_INTEGER ? length : _primordials.MAX_SAFE_INTEGER;
|
||||
}
|
||||
function SpeciesConstructor(target, defaultConstructor) {
|
||||
if (!(0, _is.isObject)(target)) {
|
||||
throw (0, _primordials.NativeTypeError)(_messages.THIS_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
const constructor = target.constructor;
|
||||
if (constructor === undefined) {
|
||||
return defaultConstructor;
|
||||
}
|
||||
if (!(0, _is.isObject)(constructor)) {
|
||||
throw (0, _primordials.NativeTypeError)(_messages.THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
const species = constructor[_primordials.SymbolSpecies];
|
||||
if (species == null) {
|
||||
return defaultConstructor;
|
||||
}
|
||||
return species;
|
||||
}
|
||||
function IsDetachedBuffer(buffer) {
|
||||
if ((0, _is.isSharedArrayBuffer)(buffer)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
(0, _primordials.ArrayBufferPrototypeSlice)(buffer, 0, 0);
|
||||
return false;
|
||||
} catch (e) {}
|
||||
return true;
|
||||
}
|
||||
function defaultCompare(x, y) {
|
||||
const isXNaN = (0, _primordials.NumberIsNaN)(x);
|
||||
const isYNaN = (0, _primordials.NumberIsNaN)(y);
|
||||
if (isXNaN && isYNaN) {
|
||||
return 0;
|
||||
}
|
||||
if (isXNaN) {
|
||||
return 1;
|
||||
}
|
||||
if (isYNaN) {
|
||||
return -1;
|
||||
}
|
||||
if (x < y) {
|
||||
return -1;
|
||||
}
|
||||
if (x > y) {
|
||||
return 1;
|
||||
}
|
||||
if (x === 0 && y === 0) {
|
||||
const isXPlusZero = (0, _primordials.ObjectIs)(x, 0);
|
||||
const isYPlusZero = (0, _primordials.ObjectIs)(y, 0);
|
||||
if (!isXPlusZero && isYPlusZero) {
|
||||
return -1;
|
||||
}
|
||||
if (isXPlusZero && !isYPlusZero) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user