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

@apache-arrow/esnext-cjs

Package Overview
Dependencies
Maintainers
7
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apache-arrow/esnext-cjs - npm Package Compare versions

Comparing version 12.0.1 to 13.0.0

4

Arrow.d.ts

@@ -122,5 +122,5 @@ export { MessageHeader } from './fb/message-header.js';

isArrowBigNumSymbol: typeof util_bn_.isArrowBigNumSymbol;
bignumToString: <T_8 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_8) => string;
bignumToBigInt: <T_9 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_9) => bigint;
bigNumToString: <T_8 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_8) => string;
bigNumToBigInt: <T_9 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_9) => bigint;
BN: typeof util_bn_.BN;
};

@@ -47,6 +47,7 @@ "use strict";

else {
const n = value.length;
const v = value;
const n = v.length;
const start = offsets.set(index, n).buffer[index];
for (let i = -1; ++i < n;) {
child.set(start + i, value[i]);
child.set(start + i, v[i]);
}

@@ -53,0 +54,0 @@ }

@@ -63,3 +63,3 @@ "use strict";

MetadataVersion[MetadataVersion["V5"] = 4] = "V5";
})(MetadataVersion = exports.MetadataVersion || (exports.MetadataVersion = {}));
})(MetadataVersion || (exports.MetadataVersion = MetadataVersion = {}));
/**

@@ -72,3 +72,3 @@ * @enum {number}

UnionMode[UnionMode["Dense"] = 1] = "Dense";
})(UnionMode = exports.UnionMode || (exports.UnionMode = {}));
})(UnionMode || (exports.UnionMode = UnionMode = {}));
/**

@@ -82,3 +82,3 @@ * @enum {number}

Precision[Precision["DOUBLE"] = 2] = "DOUBLE";
})(Precision = exports.Precision || (exports.Precision = {}));
})(Precision || (exports.Precision = Precision = {}));
/**

@@ -91,3 +91,3 @@ * @enum {number}

DateUnit[DateUnit["MILLISECOND"] = 1] = "MILLISECOND";
})(DateUnit = exports.DateUnit || (exports.DateUnit = {}));
})(DateUnit || (exports.DateUnit = DateUnit = {}));
/**

@@ -102,3 +102,3 @@ * @enum {number}

TimeUnit[TimeUnit["NANOSECOND"] = 3] = "NANOSECOND";
})(TimeUnit = exports.TimeUnit || (exports.TimeUnit = {}));
})(TimeUnit || (exports.TimeUnit = TimeUnit = {}));
/**

@@ -112,3 +112,3 @@ * @enum {number}

IntervalUnit[IntervalUnit["MONTH_DAY_NANO"] = 2] = "MONTH_DAY_NANO";
})(IntervalUnit = exports.IntervalUnit || (exports.IntervalUnit = {}));
})(IntervalUnit || (exports.IntervalUnit = IntervalUnit = {}));
/**

@@ -134,3 +134,3 @@ * ----------------------------------------------------------------------

MessageHeader[MessageHeader["SparseTensor"] = 5] = "SparseTensor";
})(MessageHeader = exports.MessageHeader || (exports.MessageHeader = {}));
})(MessageHeader || (exports.MessageHeader = MessageHeader = {}));
/**

@@ -208,3 +208,3 @@ * Main data type enumeration.

Type[Type["IntervalYearMonth"] = -26] = "IntervalYearMonth";
})(Type = exports.Type || (exports.Type = {}));
})(Type || (exports.Type = Type = {}));
var BufferType;

@@ -228,4 +228,4 @@ (function (BufferType) {

BufferType[BufferType["TYPE"] = 3] = "TYPE";
})(BufferType = exports.BufferType || (exports.BufferType = {}));
})(BufferType || (exports.BufferType = BufferType = {}));
//# sourceMappingURL=enum.js.map

@@ -22,4 +22,4 @@ "use strict";

BodyCompressionMethod[BodyCompressionMethod["BUFFER"] = 0] = "BUFFER";
})(BodyCompressionMethod = exports.BodyCompressionMethod || (exports.BodyCompressionMethod = {}));
})(BodyCompressionMethod || (exports.BodyCompressionMethod = BodyCompressionMethod = {}));
//# sourceMappingURL=body-compression-method.js.map

@@ -9,4 +9,4 @@ "use strict";

CompressionType[CompressionType["ZSTD"] = 1] = "ZSTD";
})(CompressionType = exports.CompressionType || (exports.CompressionType = {}));
})(CompressionType || (exports.CompressionType = CompressionType = {}));
//# sourceMappingURL=compression-type.js.map

@@ -9,4 +9,4 @@ "use strict";

DateUnit[DateUnit["MILLISECOND"] = 1] = "MILLISECOND";
})(DateUnit = exports.DateUnit || (exports.DateUnit = {}));
})(DateUnit || (exports.DateUnit = DateUnit = {}));
//# sourceMappingURL=date-unit.js.map

@@ -15,4 +15,4 @@ "use strict";

DictionaryKind[DictionaryKind["DenseArray"] = 0] = "DenseArray";
})(DictionaryKind = exports.DictionaryKind || (exports.DictionaryKind = {}));
})(DictionaryKind || (exports.DictionaryKind = DictionaryKind = {}));
//# sourceMappingURL=dictionary-kind.js.map

@@ -13,4 +13,4 @@ "use strict";

Endianness[Endianness["Big"] = 1] = "Big";
})(Endianness = exports.Endianness || (exports.Endianness = {}));
})(Endianness || (exports.Endianness = Endianness = {}));
//# sourceMappingURL=endianness.js.map

@@ -41,4 +41,4 @@ "use strict";

Feature["COMPRESSED_BODY"] = "2";
})(Feature = exports.Feature || (exports.Feature = {}));
})(Feature || (exports.Feature = Feature = {}));
//# sourceMappingURL=feature.js.map

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

IntervalUnit[IntervalUnit["MONTH_DAY_NANO"] = 2] = "MONTH_DAY_NANO";
})(IntervalUnit = exports.IntervalUnit || (exports.IntervalUnit = {}));
})(IntervalUnit || (exports.IntervalUnit = IntervalUnit = {}));
//# sourceMappingURL=interval-unit.js.map

@@ -28,3 +28,3 @@ "use strict";

MessageHeader[MessageHeader["SparseTensor"] = 5] = "SparseTensor";
})(MessageHeader = exports.MessageHeader || (exports.MessageHeader = {}));
})(MessageHeader || (exports.MessageHeader = MessageHeader = {}));
function unionToMessageHeader(type, accessor) {

@@ -31,0 +31,0 @@ switch (MessageHeader[type]) {

@@ -41,4 +41,4 @@ "use strict";

MetadataVersion[MetadataVersion["V5"] = 4] = "V5";
})(MetadataVersion = exports.MetadataVersion || (exports.MetadataVersion = {}));
})(MetadataVersion || (exports.MetadataVersion = MetadataVersion = {}));
//# sourceMappingURL=metadata-version.js.map

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

Precision[Precision["DOUBLE"] = 2] = "DOUBLE";
})(Precision = exports.Precision || (exports.Precision = {}));
})(Precision || (exports.Precision = Precision = {}));
//# sourceMappingURL=precision.js.map

@@ -9,4 +9,4 @@ "use strict";

SparseMatrixCompressedAxis[SparseMatrixCompressedAxis["Column"] = 1] = "Column";
})(SparseMatrixCompressedAxis = exports.SparseMatrixCompressedAxis || (exports.SparseMatrixCompressedAxis = {}));
})(SparseMatrixCompressedAxis || (exports.SparseMatrixCompressedAxis = SparseMatrixCompressedAxis = {}));
//# sourceMappingURL=sparse-matrix-compressed-axis.js.map

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

SparseTensorIndex[SparseTensorIndex["SparseTensorIndexCSF"] = 3] = "SparseTensorIndexCSF";
})(SparseTensorIndex = exports.SparseTensorIndex || (exports.SparseTensorIndex = {}));
})(SparseTensorIndex || (exports.SparseTensorIndex = SparseTensorIndex = {}));
function unionToSparseTensorIndex(type, accessor) {

@@ -17,0 +17,0 @@ switch (SparseTensorIndex[type]) {

@@ -11,4 +11,4 @@ "use strict";

TimeUnit[TimeUnit["NANOSECOND"] = 3] = "NANOSECOND";
})(TimeUnit = exports.TimeUnit || (exports.TimeUnit = {}));
})(TimeUnit || (exports.TimeUnit = TimeUnit = {}));
//# sourceMappingURL=time-unit.js.map

@@ -57,3 +57,3 @@ "use strict";

Type[Type["RunEndEncoded"] = 22] = "RunEndEncoded";
})(Type = exports.Type || (exports.Type = {}));
})(Type || (exports.Type = Type = {}));
function unionToType(type, accessor) {

@@ -60,0 +60,0 @@ switch (Type[type]) {

@@ -9,4 +9,4 @@ "use strict";

UnionMode[UnionMode["Dense"] = 1] = "Dense";
})(UnionMode = exports.UnionMode || (exports.UnionMode = {}));
})(UnionMode || (exports.UnionMode = UnionMode = {}));
//# sourceMappingURL=union-mode.js.map

@@ -5,2 +5,3 @@ /// <reference types="node" />

/// <reference types="node" />
/// <reference types="node" />
import { ArrayBufferViewInput } from '../util/buffer.js';

@@ -7,0 +8,0 @@ import { ReadableDOMStreamOptions } from './interfaces.js';

{
"version": "12.0.1",
"version": "13.0.0",
"name": "@apache-arrow/esnext-cjs",

@@ -26,10 +26,10 @@ "browser": "Arrow.dom.js",

"@types/command-line-usage": "5.0.2",
"@types/node": "18.14.5",
"@types/node": "20.3.0",
"@types/pad-left": "2.1.1",
"command-line-args": "5.2.1",
"command-line-usage": "6.1.3",
"flatbuffers": "23.3.3",
"command-line-usage": "7.0.1",
"flatbuffers": "23.5.26",
"json-bignum": "^0.0.3",
"pad-left": "^2.1.0",
"tslib": "^2.5.0"
"tslib": "^2.5.3"
},

@@ -36,0 +36,0 @@ "bin": {

@@ -45,6 +45,7 @@ // Licensed to the Apache Software Foundation (ASF) under one

} else {
const n = value.length;
const v = value as T['TValue'];
const n = v.length;
const start = offsets.set(index, n).buffer[index];
for (let i = -1; ++i < n;) {
child.set(start + i, value[i]);
child.set(start + i, v[i]);
}

@@ -51,0 +52,0 @@ }

@@ -94,3 +94,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

if (args[args.length - 1] instanceof Uint32Array) {
if (args.at(-1) instanceof Uint32Array) {
offsets = args.pop();

@@ -97,0 +97,0 @@ }

@@ -23,3 +23,2 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { TypedArrayConstructor } from './interfaces.js';
import { BigInt64Array, BigUint64Array } from './util/compat.js';
import { bigIntToNumber } from './util/bigint.js';

@@ -26,0 +25,0 @@

@@ -21,3 +21,2 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { BigIntArray, BigIntArrayConstructor } from '../interfaces.js';
import { BigInt64Array, BigUint64Array } from './compat.js';

@@ -40,13 +39,13 @@ /** @ignore */

BigNum.prototype[isArrowBigNumSymbol] = true;
BigNum.prototype.toJSON = function <T extends BN<BigNumArray>>(this: T) { return `"${bignumToString(this)}"`; };
BigNum.prototype.valueOf = function <T extends BN<BigNumArray>>(this: T) { return bignumToNumber(this); };
BigNum.prototype.toString = function <T extends BN<BigNumArray>>(this: T) { return bignumToString(this); };
BigNum.prototype.toJSON = function <T extends BN<BigNumArray>>(this: T) { return `"${bigNumToString(this)}"`; };
BigNum.prototype.valueOf = function <T extends BN<BigNumArray>>(this: T) { return bigNumToNumber(this); };
BigNum.prototype.toString = function <T extends BN<BigNumArray>>(this: T) { return bigNumToString(this); };
BigNum.prototype[Symbol.toPrimitive] = function <T extends BN<BigNumArray>>(this: T, hint: 'string' | 'number' | 'default' = 'default') {
switch (hint) {
case 'number': return bignumToNumber(this);
case 'string': return bignumToString(this);
case 'default': return bignumToBigInt(this);
case 'number': return bigNumToNumber(this);
case 'string': return bigNumToString(this);
case 'default': return bigNumToBigInt(this);
}
// @ts-ignore
return bignumToString(this);
return bigNumToString(this);
};

@@ -75,6 +74,6 @@

/** @ignore */
function bignumToNumber<T extends BN<BigNumArray>>(bn: T) {
function bigNumToNumber<T extends BN<BigNumArray>>(bn: T) {
const { buffer, byteOffset, length, 'signed': signed } = bn;
const words = new BigUint64Array(buffer, byteOffset, length);
const negative = signed && words[words.length - 1] & (BigInt(1) << BigInt(63));
const negative = signed && words.at(-1)! & (BigInt(1) << BigInt(63));
let number = negative ? BigInt(1) : BigInt(0);

@@ -96,8 +95,48 @@ let i = BigInt(0);

/** @ignore */
export const bignumToString: { <T extends BN<BigNumArray>>(a: T): string } = (<T extends BN<BigNumArray>>(a: T) => a.byteLength === 8 ? `${new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0]}` : decimalToString(a));
export const bigNumToString: { <T extends BN<BigNumArray>>(a: T): string } = (<T extends BN<BigNumArray>>(a: T) => {
// use BigInt native implementation
if (a.byteLength === 8) {
const bigIntArray = new a['BigIntArray'](a.buffer, a.byteOffset, 1);
return `${bigIntArray[0]}`;
}
// unsigned numbers
if (!a['signed']) {
return unsignedBigNumToString(a);
}
let array = new Uint16Array(a.buffer, a.byteOffset, a.byteLength / 2);
// detect positive numbers
const highOrderWord = new Int16Array([array.at(-1)!])[0];
if (highOrderWord >= 0) {
return unsignedBigNumToString(a);
}
// flip the negative value
array = array.slice();
let carry = 1;
for (let i = 0; i < array.length; i++) {
const elem = array[i];
const updated = ~elem + carry;
array[i] = updated;
carry &= elem === 0 ? 1 : 0;
}
const negated = unsignedBigNumToString(<any>array);
return `-${negated}`;
});
/** @ignore */
export const bignumToBigInt: { <T extends BN<BigNumArray>>(a: T): bigint } = (<T extends BN<BigNumArray>>(a: T) => a.byteLength === 8 ? new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0] : <any>decimalToString(a));
export const bigNumToBigInt: { <T extends BN<BigNumArray>>(a: T): bigint } = (<T extends BN<BigNumArray>>(a: T) => {
if (a.byteLength === 8) {
const bigIntArray = new a['BigIntArray'](a.buffer, a.byteOffset, 1);
return bigIntArray[0];
} else {
return <any>bigNumToString(a);
}
});
/** @ignore */
function decimalToString<T extends BN<BigNumArray>>(a: T) {
function unsignedBigNumToString<T extends BN<BigNumArray>>(a: T) {
let digits = '';

@@ -104,0 +143,0 @@ const base64 = new Uint32Array(2);

@@ -20,3 +20,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { TypedArray, TypedArrayConstructor, BigIntArrayConstructor } from '../interfaces.js';
import { isPromise, isIterable, isAsyncIterable, isIteratorResult, isFlatbuffersByteBuffer, BigInt64Array, BigUint64Array } from './compat.js';
import { isPromise, isIterable, isAsyncIterable, isIteratorResult, isFlatbuffersByteBuffer } from './compat.js';
import { ByteBuffer } from 'flatbuffers';

@@ -67,3 +67,3 @@

const byteLength = result.reduce((x, b) => x + b.byteLength, 0);
let source: Uint8Array, sliced: Uint8Array, buffer: Uint8Array | void;
let source: Uint8Array, sliced: Uint8Array, buffer: Uint8Array | undefined;
let offset = 0, index = -1;

@@ -70,0 +70,0 @@ const length = Math.min(size || Number.POSITIVE_INFINITY, byteLength);

@@ -45,29 +45,2 @@ // Licensed to the Apache Software Foundation (ASF) under one

/** @ignore */
const [BigInt64ArrayCtor, BigInt64ArrayAvailable] = (() => {
const BigInt64ArrayUnavailableError = () => { throw new Error('BigInt64Array is not available in this environment'); };
class BigInt64ArrayUnavailable {
static get BYTES_PER_ELEMENT() { return 8; }
static of() { throw BigInt64ArrayUnavailableError(); }
static from() { throw BigInt64ArrayUnavailableError(); }
constructor() { throw BigInt64ArrayUnavailableError(); }
}
return typeof BigInt64Array !== 'undefined' ? [BigInt64Array, true] : [<any>BigInt64ArrayUnavailable, false];
})() as [BigInt64ArrayConstructor, boolean];
/** @ignore */
const [BigUint64ArrayCtor, BigUint64ArrayAvailable] = (() => {
const BigUint64ArrayUnavailableError = () => { throw new Error('BigUint64Array is not available in this environment'); };
class BigUint64ArrayUnavailable {
static get BYTES_PER_ELEMENT() { return 8; }
static of() { throw BigUint64ArrayUnavailableError(); }
static from() { throw BigUint64ArrayUnavailableError(); }
constructor() { throw BigUint64ArrayUnavailableError(); }
}
return typeof BigUint64Array !== 'undefined' ? [BigUint64Array, true] : [<any>BigUint64ArrayUnavailable, false];
})() as [BigUint64ArrayConstructor, boolean];
export { BigInt64ArrayCtor as BigInt64Array, BigInt64ArrayAvailable };
export { BigUint64ArrayCtor as BigUint64Array, BigUint64ArrayAvailable };
/** @ignore */ const isNumber = (x: any) => typeof x === 'number';

@@ -74,0 +47,0 @@ /** @ignore */ const isBoolean = (x: any) => typeof x === 'boolean';

@@ -18,4 +18,2 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { BigInt64Array, BigUint64Array } from './compat.js';
/** @ignore */ const undf = void (0);

@@ -22,0 +20,0 @@

@@ -33,3 +33,2 @@ // Licensed to the Apache Software Foundation (ASF) under one

} from './util/chunk.js';
import { BigInt64Array, BigUint64Array } from './util/compat.js';

@@ -100,3 +99,3 @@ import { instance as getVisitor } from './visitor/get.js';

this.numChildren = type.children?.length ?? 0;
this.length = this._offsets[this._offsets.length - 1];
this.length = this._offsets.at(-1)!;
}

@@ -154,3 +153,3 @@

/**
* The Array or TypedAray constructor used for the JS representation
* The Array or TypedArray constructor used for the JS representation
* of the element's values in {@link Vector.prototype.toArray `toArray()`}.

@@ -157,0 +156,0 @@ */

@@ -54,3 +54,3 @@ "use strict";

}
if (args[args.length - 1] instanceof Uint32Array) {
if (args.at(-1) instanceof Uint32Array) {
offsets = args.pop();

@@ -57,0 +57,0 @@ }

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

exports.strideForType = exports.Dictionary = exports.Map_ = exports.FixedSizeList = exports.FixedSizeBinary = exports.SparseUnion = exports.DenseUnion = exports.Union = exports.Struct = exports.List = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.Decimal = exports.Bool = exports.Utf8 = exports.Binary = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Null = exports.DataType = void 0;
const compat_js_1 = require("./util/compat.js");
const bigint_js_1 = require("./util/bigint.js");

@@ -79,3 +78,3 @@ const enum_js_1 = require("./enum.js");

case 32: return this.isSigned ? Int32Array : Uint32Array;
case 64: return this.isSigned ? compat_js_1.BigInt64Array : compat_js_1.BigUint64Array;
case 64: return this.isSigned ? BigInt64Array : BigUint64Array;
}

@@ -113,3 +112,3 @@ throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);

constructor() { super(true, 64); }
get ArrayType() { return compat_js_1.BigInt64Array; }
get ArrayType() { return BigInt64Array; }
}

@@ -138,3 +137,3 @@ exports.Int64 = Int64;

constructor() { super(false, 64); }
get ArrayType() { return compat_js_1.BigUint64Array; }
get ArrayType() { return BigUint64Array; }
}

@@ -145,7 +144,7 @@ exports.Uint64 = Uint64;

Object.defineProperty(Int32.prototype, 'ArrayType', { value: Int32Array });
Object.defineProperty(Int64.prototype, 'ArrayType', { value: compat_js_1.BigInt64Array });
Object.defineProperty(Int64.prototype, 'ArrayType', { value: BigInt64Array });
Object.defineProperty(Uint8.prototype, 'ArrayType', { value: Uint8Array });
Object.defineProperty(Uint16.prototype, 'ArrayType', { value: Uint16Array });
Object.defineProperty(Uint32.prototype, 'ArrayType', { value: Uint32Array });
Object.defineProperty(Uint64.prototype, 'ArrayType', { value: compat_js_1.BigUint64Array });
Object.defineProperty(Uint64.prototype, 'ArrayType', { value: BigUint64Array });
/** @ignore */

@@ -293,3 +292,3 @@ class Float extends DataType {

case 32: return Int32Array;
case 64: return compat_js_1.BigInt64Array;
case 64: return BigInt64Array;
}

@@ -296,0 +295,0 @@ // @ts-ignore

@@ -10,7 +10,7 @@ import { ArrayBufferViewInput } from './buffer.js';

/** @ignore */
export declare const bignumToString: {
export declare const bigNumToString: {
<T extends BN<BigNumArray>>(a: T): string;
};
/** @ignore */
export declare const bignumToBigInt: {
export declare const bigNumToBigInt: {
<T extends BN<BigNumArray>>(a: T): bigint;

@@ -17,0 +17,0 @@ };

@@ -19,5 +19,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.BN = exports.bignumToBigInt = exports.bignumToString = exports.isArrowBigNumSymbol = void 0;
exports.BN = exports.bigNumToBigInt = exports.bigNumToString = exports.isArrowBigNumSymbol = void 0;
const buffer_js_1 = require("./buffer.js");
const compat_js_1 = require("./compat.js");
/** @ignore */

@@ -33,13 +32,13 @@ exports.isArrowBigNumSymbol = Symbol.for('isArrowBigNum');

BigNum.prototype[exports.isArrowBigNumSymbol] = true;
BigNum.prototype.toJSON = function () { return `"${(0, exports.bignumToString)(this)}"`; };
BigNum.prototype.valueOf = function () { return bignumToNumber(this); };
BigNum.prototype.toString = function () { return (0, exports.bignumToString)(this); };
BigNum.prototype.toJSON = function () { return `"${(0, exports.bigNumToString)(this)}"`; };
BigNum.prototype.valueOf = function () { return bigNumToNumber(this); };
BigNum.prototype.toString = function () { return (0, exports.bigNumToString)(this); };
BigNum.prototype[Symbol.toPrimitive] = function (hint = 'default') {
switch (hint) {
case 'number': return bignumToNumber(this);
case 'string': return (0, exports.bignumToString)(this);
case 'default': return (0, exports.bignumToBigInt)(this);
case 'number': return bigNumToNumber(this);
case 'string': return (0, exports.bigNumToString)(this);
case 'default': return (0, exports.bigNumToBigInt)(this);
}
// @ts-ignore
return (0, exports.bignumToString)(this);
return (0, exports.bigNumToString)(this);
};

@@ -55,10 +54,10 @@ /** @ignore */

Object.setPrototypeOf(DecimalBigNum.prototype, Object.create(Uint32Array.prototype));
Object.assign(SignedBigNum.prototype, BigNum.prototype, { 'constructor': SignedBigNum, 'signed': true, 'TypedArray': Int32Array, 'BigIntArray': compat_js_1.BigInt64Array });
Object.assign(UnsignedBigNum.prototype, BigNum.prototype, { 'constructor': UnsignedBigNum, 'signed': false, 'TypedArray': Uint32Array, 'BigIntArray': compat_js_1.BigUint64Array });
Object.assign(DecimalBigNum.prototype, BigNum.prototype, { 'constructor': DecimalBigNum, 'signed': true, 'TypedArray': Uint32Array, 'BigIntArray': compat_js_1.BigUint64Array });
Object.assign(SignedBigNum.prototype, BigNum.prototype, { 'constructor': SignedBigNum, 'signed': true, 'TypedArray': Int32Array, 'BigIntArray': BigInt64Array });
Object.assign(UnsignedBigNum.prototype, BigNum.prototype, { 'constructor': UnsignedBigNum, 'signed': false, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64Array });
Object.assign(DecimalBigNum.prototype, BigNum.prototype, { 'constructor': DecimalBigNum, 'signed': true, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64Array });
/** @ignore */
function bignumToNumber(bn) {
function bigNumToNumber(bn) {
const { buffer, byteOffset, length, 'signed': signed } = bn;
const words = new compat_js_1.BigUint64Array(buffer, byteOffset, length);
const negative = signed && words[words.length - 1] & (BigInt(1) << BigInt(63));
const words = new BigUint64Array(buffer, byteOffset, length);
const negative = signed && words.at(-1) & (BigInt(1) << BigInt(63));
let number = negative ? BigInt(1) : BigInt(0);

@@ -80,7 +79,42 @@ let i = BigInt(0);

/** @ignore */
exports.bignumToString = ((a) => a.byteLength === 8 ? `${new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0]}` : decimalToString(a));
exports.bigNumToString = ((a) => {
// use BigInt native implementation
if (a.byteLength === 8) {
const bigIntArray = new a['BigIntArray'](a.buffer, a.byteOffset, 1);
return `${bigIntArray[0]}`;
}
// unsigned numbers
if (!a['signed']) {
return unsignedBigNumToString(a);
}
let array = new Uint16Array(a.buffer, a.byteOffset, a.byteLength / 2);
// detect positive numbers
const highOrderWord = new Int16Array([array.at(-1)])[0];
if (highOrderWord >= 0) {
return unsignedBigNumToString(a);
}
// flip the negative value
array = array.slice();
let carry = 1;
for (let i = 0; i < array.length; i++) {
const elem = array[i];
const updated = ~elem + carry;
array[i] = updated;
carry &= elem === 0 ? 1 : 0;
}
const negated = unsignedBigNumToString(array);
return `-${negated}`;
});
/** @ignore */
exports.bignumToBigInt = ((a) => a.byteLength === 8 ? new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0] : decimalToString(a));
exports.bigNumToBigInt = ((a) => {
if (a.byteLength === 8) {
const bigIntArray = new a['BigIntArray'](a.buffer, a.byteOffset, 1);
return bigIntArray[0];
}
else {
return (0, exports.bigNumToString)(a);
}
});
/** @ignore */
function decimalToString(a) {
function unsignedBigNumToString(a) {
let digits = '';

@@ -115,3 +149,3 @@ const base64 = new Uint32Array(2);

case Int32Array:
case compat_js_1.BigInt64Array:
case BigInt64Array:
return new SignedBigNum(num);

@@ -118,0 +152,0 @@ }

@@ -121,3 +121,3 @@ "use strict";

exports.toInt32Array = toInt32Array;
/** @ignore */ const toBigInt64Array = (input) => toArrayBufferView(compat_js_1.BigInt64Array, input);
/** @ignore */ const toBigInt64Array = (input) => toArrayBufferView(BigInt64Array, input);
exports.toBigInt64Array = toBigInt64Array;

@@ -130,3 +130,3 @@ /** @ignore */ const toUint8Array = (input) => toArrayBufferView(Uint8Array, input);

exports.toUint32Array = toUint32Array;
/** @ignore */ const toBigUint64Array = (input) => toArrayBufferView(compat_js_1.BigUint64Array, input);
/** @ignore */ const toBigUint64Array = (input) => toArrayBufferView(BigUint64Array, input);
exports.toBigUint64Array = toBigUint64Array;

@@ -133,0 +133,0 @@ /** @ignore */ const toFloat32Array = (input) => toArrayBufferView(Float32Array, input);

@@ -0,1 +1,3 @@

/// <reference types="node" />
/// <reference types="node" />
import { ArrowJSONLike } from '../io/interfaces.js';

@@ -18,8 +20,2 @@ /** @ignore */

/** @ignore */
declare const BigInt64ArrayCtor: BigInt64ArrayConstructor, BigInt64ArrayAvailable: boolean;
/** @ignore */
declare const BigUint64ArrayCtor: BigUint64ArrayConstructor, BigUint64ArrayAvailable: boolean;
export { BigInt64ArrayCtor as BigInt64Array, BigInt64ArrayAvailable };
export { BigUint64ArrayCtor as BigUint64Array, BigUint64ArrayAvailable };
/** @ignore */
export declare const isObject: (x: any) => x is Object;

@@ -26,0 +22,0 @@ /** @ignore */

@@ -19,29 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isFlatbuffersByteBuffer = exports.isReadableNodeStream = exports.isWritableNodeStream = exports.isReadableDOMStream = exports.isWritableDOMStream = exports.isFetchResponse = exports.isFSReadStream = exports.isFileHandle = exports.isUnderlyingSink = exports.isIteratorResult = exports.isArrayLike = exports.isArrowJSON = exports.isAsyncIterable = exports.isIterable = exports.isObservable = exports.isPromise = exports.isObject = exports.BigUint64ArrayAvailable = exports.BigUint64Array = exports.BigInt64ArrayAvailable = exports.BigInt64Array = void 0;
/** @ignore */
const [BigInt64ArrayCtor, BigInt64ArrayAvailable] = (() => {
const BigInt64ArrayUnavailableError = () => { throw new Error('BigInt64Array is not available in this environment'); };
class BigInt64ArrayUnavailable {
static get BYTES_PER_ELEMENT() { return 8; }
static of() { throw BigInt64ArrayUnavailableError(); }
static from() { throw BigInt64ArrayUnavailableError(); }
constructor() { throw BigInt64ArrayUnavailableError(); }
}
return typeof BigInt64Array !== 'undefined' ? [BigInt64Array, true] : [BigInt64ArrayUnavailable, false];
})();
exports.BigInt64Array = BigInt64ArrayCtor;
exports.BigInt64ArrayAvailable = BigInt64ArrayAvailable;
/** @ignore */
const [BigUint64ArrayCtor, BigUint64ArrayAvailable] = (() => {
const BigUint64ArrayUnavailableError = () => { throw new Error('BigUint64Array is not available in this environment'); };
class BigUint64ArrayUnavailable {
static get BYTES_PER_ELEMENT() { return 8; }
static of() { throw BigUint64ArrayUnavailableError(); }
static from() { throw BigUint64ArrayUnavailableError(); }
constructor() { throw BigUint64ArrayUnavailableError(); }
}
return typeof BigUint64Array !== 'undefined' ? [BigUint64Array, true] : [BigUint64ArrayUnavailable, false];
})();
exports.BigUint64Array = BigUint64ArrayCtor;
exports.BigUint64ArrayAvailable = BigUint64ArrayAvailable;
exports.isFlatbuffersByteBuffer = exports.isReadableNodeStream = exports.isWritableNodeStream = exports.isReadableDOMStream = exports.isWritableDOMStream = exports.isFetchResponse = exports.isFSReadStream = exports.isFileHandle = exports.isUnderlyingSink = exports.isIteratorResult = exports.isArrayLike = exports.isArrowJSON = exports.isAsyncIterable = exports.isIterable = exports.isObservable = exports.isPromise = exports.isObject = void 0;
/** @ignore */ const isNumber = (x) => typeof x === 'number';

@@ -48,0 +22,0 @@ /** @ignore */ const isBoolean = (x) => typeof x === 'boolean';

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

exports.valueToString = void 0;
const compat_js_1 = require("./compat.js");
/** @ignore */ const undf = void (0);

@@ -44,3 +43,3 @@ /** @ignore */

if (ArrayBuffer.isView(x)) {
if (x instanceof compat_js_1.BigInt64Array || x instanceof compat_js_1.BigUint64Array) {
if (x instanceof BigInt64Array || x instanceof BigUint64Array) {
return `[${[...x].map(x => valueToString(x))}]`;

@@ -47,0 +46,0 @@ }

@@ -50,3 +50,3 @@ import { DataType } from './type.js';

/**
* The Array or TypedAray constructor used for the JS representation
* The Array or TypedArray constructor used for the JS representation
* of the element's values in {@link Vector.prototype.toArray `toArray()`}.

@@ -53,0 +53,0 @@ */

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

const chunk_js_1 = require("./util/chunk.js");
const compat_js_1 = require("./util/compat.js");
const get_js_1 = require("./visitor/get.js");

@@ -72,3 +71,3 @@ const set_js_1 = require("./visitor/set.js");

this.numChildren = type.children?.length ?? 0;
this.length = this._offsets[this._offsets.length - 1];
this.length = this._offsets.at(-1);
}

@@ -94,3 +93,3 @@ /**

/**
* The Array or TypedAray constructor used for the JS representation
* The Array or TypedArray constructor used for the JS representation
* of the element's values in {@link Vector.prototype.toArray `toArray()`}.

@@ -367,3 +366,3 @@ */

}
if (init instanceof compat_js_1.BigInt64Array) {
if (init instanceof BigInt64Array) {
return new Vector([(0, data_js_1.makeData)({ ...props, type: new dtypes.Int64 })]);

@@ -380,3 +379,3 @@ }

}
if (init instanceof compat_js_1.BigUint64Array) {
if (init instanceof BigUint64Array) {
return new Vector([(0, data_js_1.makeData)({ ...props, type: new dtypes.Uint64 })]);

@@ -383,0 +382,0 @@ }

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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc