nodes2ts 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export.cjs +22 -3
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +18 -9
- package/dist/export.d.ts +18 -9
- package/dist/export.js +22 -3
- package/dist/export.js.map +1 -1
- package/package.json +1 -1
package/dist/export.cjs
CHANGED
|
@@ -3600,14 +3600,33 @@ var S2Projections = _S2Projections;
|
|
|
3600
3600
|
// src/S2CellId.ts
|
|
3601
3601
|
var _S2CellId = class _S2CellId {
|
|
3602
3602
|
/**
|
|
3603
|
-
* Construct an S2CellId from a bigint
|
|
3603
|
+
* Construct an S2CellId from a bigint, decimal string, or number.
|
|
3604
3604
|
*
|
|
3605
3605
|
* The string may be signed ("-6533045114107854848") or unsigned
|
|
3606
3606
|
* ("11913698959601696768"); both are handled via BigInt.asUintN(64, ...).
|
|
3607
|
+
*
|
|
3608
|
+
* Numbers must be finite integers within the safe-integer range
|
|
3609
|
+
* (|n| ≤ Number.MAX_SAFE_INTEGER = 2^53 − 1). Values outside that range
|
|
3610
|
+
* may have silently lost precision in JS before reaching this constructor,
|
|
3611
|
+
* so a RangeError is thrown. Use a bigint literal for large cell IDs
|
|
3612
|
+
* (e.g. `-9182983676231680000n`).
|
|
3613
|
+
*
|
|
3614
|
+
* @throws {TypeError} if `id` is a non-integer or non-finite number.
|
|
3615
|
+
* @throws {RangeError} if `id` exceeds safe-integer precision (> 2^53 − 1).
|
|
3607
3616
|
*/
|
|
3608
3617
|
constructor(id) {
|
|
3609
3618
|
if (typeof id === "string") {
|
|
3610
3619
|
this.id = BigInt.asUintN(64, BigInt(id));
|
|
3620
|
+
} else if (typeof id === "number") {
|
|
3621
|
+
if (!Number.isInteger(id) || !isFinite(id)) {
|
|
3622
|
+
throw new TypeError(`S2CellId: non-integer or non-finite number: ${id}`);
|
|
3623
|
+
}
|
|
3624
|
+
if (!Number.isSafeInteger(id)) {
|
|
3625
|
+
throw new RangeError(
|
|
3626
|
+
`S2CellId: number ${id} exceeds safe integer precision (> 2^53). Use a bigint literal instead, e.g. ${BigInt(id)}n`
|
|
3627
|
+
);
|
|
3628
|
+
}
|
|
3629
|
+
this.id = BigInt.asUintN(64, BigInt(id));
|
|
3611
3630
|
} else {
|
|
3612
3631
|
this.id = BigInt.asUintN(64, id);
|
|
3613
3632
|
}
|
|
@@ -4191,7 +4210,7 @@ var _S2CellId = class _S2CellId {
|
|
|
4191
4210
|
* Binary search in a sorted S2CellId array.
|
|
4192
4211
|
* Returns index if found, or -(insertionPoint+1) if not found.
|
|
4193
4212
|
*
|
|
4194
|
-
* v4: `_id` accepts bigint, string, or S2CellId (was Long, string, or S2CellId).
|
|
4213
|
+
* v4: `_id` accepts bigint, string, number, or S2CellId (was Long, string, or S2CellId).
|
|
4195
4214
|
*/
|
|
4196
4215
|
static binarySearch(ids, _id, low = 0) {
|
|
4197
4216
|
let id;
|
|
@@ -4628,7 +4647,7 @@ var S2CellUnion = class {
|
|
|
4628
4647
|
* Populates a cell union with the given S2CellIds or 64-bit cell ids, and
|
|
4629
4648
|
* then calls Normalize().
|
|
4630
4649
|
*
|
|
4631
|
-
* v4: `cellIds` accepts `bigint[] | string[]` (was `Long[] | string[]`).
|
|
4650
|
+
* v4: `cellIds` accepts `bigint[] | string[] | number[]` (was `Long[] | string[]`).
|
|
4632
4651
|
*/
|
|
4633
4652
|
initFromIds(cellIds) {
|
|
4634
4653
|
this.initRawIds(cellIds);
|