xantiagoma 0.2.1 → 0.3.0

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.
Files changed (95) hide show
  1. package/README.md +155 -17
  2. package/dist/entry-big.cjs +40 -0
  3. package/dist/entry-big.cjs.map +1 -0
  4. package/dist/entry-big.d.cts +21 -0
  5. package/dist/entry-big.d.mts +21 -0
  6. package/dist/entry-big.mjs +36 -0
  7. package/dist/entry-big.mjs.map +1 -0
  8. package/dist/entry-bignumber.cjs +39 -0
  9. package/dist/entry-bignumber.cjs.map +1 -0
  10. package/dist/entry-bignumber.d.cts +20 -0
  11. package/dist/entry-bignumber.d.mts +20 -0
  12. package/dist/entry-bignumber.mjs +36 -0
  13. package/dist/entry-bignumber.mjs.map +1 -0
  14. package/dist/entry-decimal.cjs +47 -0
  15. package/dist/entry-decimal.cjs.map +1 -0
  16. package/dist/entry-decimal.d.cts +23 -0
  17. package/dist/entry-decimal.d.mts +23 -0
  18. package/dist/entry-decimal.mjs +43 -0
  19. package/dist/entry-decimal.mjs.map +1 -0
  20. package/dist/entry-dinero.cjs +66 -0
  21. package/dist/entry-dinero.cjs.map +1 -0
  22. package/dist/entry-dinero.d.cts +32 -0
  23. package/dist/entry-dinero.d.mts +32 -0
  24. package/dist/entry-dinero.mjs +63 -0
  25. package/dist/entry-dinero.mjs.map +1 -0
  26. package/dist/entry-fraction.cjs +42 -0
  27. package/dist/entry-fraction.cjs.map +1 -0
  28. package/dist/entry-fraction.d.cts +23 -0
  29. package/dist/entry-fraction.d.mts +23 -0
  30. package/dist/entry-fraction.mjs +38 -0
  31. package/dist/entry-fraction.mjs.map +1 -0
  32. package/dist/entry-interval.cjs +159 -0
  33. package/dist/entry-interval.cjs.map +1 -0
  34. package/dist/entry-interval.d.cts +70 -0
  35. package/dist/entry-interval.d.mts +70 -0
  36. package/dist/entry-interval.mjs +144 -0
  37. package/dist/entry-interval.mjs.map +1 -0
  38. package/dist/entry-ip.cjs +77 -0
  39. package/dist/entry-ip.cjs.map +1 -0
  40. package/dist/entry-ip.d.cts +31 -0
  41. package/dist/entry-ip.d.mts +31 -0
  42. package/dist/entry-ip.mjs +73 -0
  43. package/dist/entry-ip.mjs.map +1 -0
  44. package/dist/entry-pagination-drizzle.d.cts +1 -1
  45. package/dist/entry-pagination-drizzle.d.mts +1 -1
  46. package/dist/entry-pagination-knex.cjs +1 -1
  47. package/dist/entry-pagination-knex.d.cts +1 -1
  48. package/dist/entry-pagination-knex.d.mts +1 -1
  49. package/dist/entry-pagination-knex.mjs +1 -1
  50. package/dist/entry-pagination-kysely.d.cts +1 -1
  51. package/dist/entry-pagination-kysely.d.mts +1 -1
  52. package/dist/entry-pagination-mongo.d.cts +1 -1
  53. package/dist/entry-pagination-mongo.d.mts +1 -1
  54. package/dist/entry-pagination-prisma.d.cts +1 -1
  55. package/dist/entry-pagination-prisma.d.mts +1 -1
  56. package/dist/entry-pagination.cjs +1 -1
  57. package/dist/entry-pagination.d.cts +1 -1
  58. package/dist/entry-pagination.d.mts +1 -1
  59. package/dist/entry-pagination.mjs +1 -1
  60. package/dist/entry-react.d.cts +1 -1
  61. package/dist/entry-react.d.mts +1 -1
  62. package/dist/entry-semver.cjs +46 -0
  63. package/dist/entry-semver.cjs.map +1 -0
  64. package/dist/entry-semver.d.cts +21 -0
  65. package/dist/entry-semver.d.mts +21 -0
  66. package/dist/entry-semver.mjs +43 -0
  67. package/dist/entry-semver.mjs.map +1 -0
  68. package/dist/entry-sonner.d.cts +1 -1
  69. package/dist/entry-sonner.d.mts +1 -1
  70. package/dist/entry-temporal.cjs +118 -22
  71. package/dist/entry-temporal.cjs.map +1 -1
  72. package/dist/entry-temporal.d.cts +35 -2
  73. package/dist/entry-temporal.d.mts +35 -2
  74. package/dist/entry-temporal.mjs +88 -2
  75. package/dist/entry-temporal.mjs.map +1 -1
  76. package/dist/{index-BfArSGL_.d.mts → index-B6mDpM2h.d.mts} +2 -2
  77. package/dist/{index-k0rTrMol.d.cts → index-CxVYEVnr.d.cts} +2 -2
  78. package/dist/index.d.cts +2 -2
  79. package/dist/index.d.mts +2 -2
  80. package/dist/interval-BsZKdewu.cjs +580 -0
  81. package/dist/interval-BsZKdewu.cjs.map +1 -0
  82. package/dist/interval-C_s8UAce.mjs +557 -0
  83. package/dist/interval-C_s8UAce.mjs.map +1 -0
  84. package/dist/interval-Cz4Twj1-.d.cts +255 -0
  85. package/dist/interval-D1wAtNyH.d.mts +255 -0
  86. package/dist/{keyset-BiguUVI7.cjs → keyset-Cf2yUg5B.cjs} +1 -1
  87. package/dist/{keyset-ChU9XDqc.mjs.map → keyset-Cf2yUg5B.cjs.map} +1 -1
  88. package/dist/{keyset-Cd8leiME.d.mts → keyset-CkLbIP9i.d.cts} +2 -2
  89. package/dist/{keyset-DqmiNJog.d.cts → keyset-D5ur-RJK.d.mts} +2 -2
  90. package/dist/{keyset-ChU9XDqc.mjs → keyset-DK3GCHgB.mjs} +1 -1
  91. package/dist/{keyset-BiguUVI7.cjs.map → keyset-DK3GCHgB.mjs.map} +1 -1
  92. package/dist/{types-DDbcxhql.d.mts → types-DByI1pYe.d.mts} +1 -1
  93. package/dist/{types-i-wXHPp4.d.cts → types-DJZo0qHE.d.cts} +1 -1
  94. package/docs/INTERVAL.md +466 -0
  95. package/package.json +121 -4
package/README.md CHANGED
@@ -26,23 +26,31 @@ Release process notes live in [docs/RELEASING.md](./docs/RELEASING.md).
26
26
 
27
27
  ## Entry Points
28
28
 
29
- | Import | Description | Dependencies |
30
- | ------------------------------- | -------------------------------------- | -------------------------------- |
31
- | `xantiagoma` | Core utilities (isomorphic, zero deps) | none |
32
- | `xantiagoma/pagination` | Pagination + keyset helpers | none |
33
- | `xantiagoma/pagination/drizzle` | Drizzle adapter for pagination keysets | `drizzle-orm` |
34
- | `xantiagoma/pagination/kysely` | Kysely adapter for pagination keysets | `kysely` |
35
- | `xantiagoma/pagination/knex` | Knex adapter for pagination keysets | none |
36
- | `xantiagoma/pagination/mongo` | Mongo/Mongoose adapter for keysets | none |
37
- | `xantiagoma/pagination/prisma` | Prisma adapter for pagination keysets | none |
38
- | `xantiagoma/web` | Browser/FormData utilities | none |
39
- | `xantiagoma/ulid` | Prefixed ULID generation + helpers | `ulid` |
40
- | `xantiagoma/temporal` | Date/time/duration with Temporal API | `temporal-polyfill`, `itty-time` |
41
- | `xantiagoma/dataloader` | DataLoader factory | `dataloader` |
42
- | `xantiagoma/unstorage` | Cache helpers with unstorage | `unstorage`, `ohash` |
43
- | `xantiagoma/valibot` | TimeZone validation schema | `valibot` |
44
- | `xantiagoma/sonner` | Toast streaming for iterables | `sonner`, `react` |
45
- | `xantiagoma/react` | React hooks + components | `react`, `@tanstack/react-query` |
29
+ | Import | Description | Dependencies |
30
+ | ------------------------------- | --------------------------------------- | ------------------------------------ |
31
+ | `xantiagoma` | Core utilities (isomorphic, zero deps) | none |
32
+ | `xantiagoma/interval` | Generic `Interval<T>` (Guava Range) | none |
33
+ | `xantiagoma/dinero` | Money intervals (`Interval` of money) | `dinero.js` |
34
+ | `xantiagoma/decimal` | Exact-decimal intervals (decimal.js) | `decimal.js` |
35
+ | `xantiagoma/big` | Exact-decimal intervals (big.js) | `big.js` |
36
+ | `xantiagoma/bignumber` | Exact-decimal intervals (bignumber.js) | `bignumber.js` |
37
+ | `xantiagoma/fraction` | Exact-rational intervals (fraction.js) | `fraction.js` |
38
+ | `xantiagoma/semver` | Semantic-version range intervals | `semver` |
39
+ | `xantiagoma/ip` | IPv4/IPv6 address & CIDR intervals | `ipaddr.js` |
40
+ | `xantiagoma/pagination` | Pagination + keyset helpers | none |
41
+ | `xantiagoma/pagination/drizzle` | Drizzle adapter for pagination keysets | `drizzle-orm` |
42
+ | `xantiagoma/pagination/kysely` | Kysely adapter for pagination keysets | `kysely` |
43
+ | `xantiagoma/pagination/knex` | Knex adapter for pagination keysets | none |
44
+ | `xantiagoma/pagination/mongo` | Mongo/Mongoose adapter for keysets | none |
45
+ | `xantiagoma/pagination/prisma` | Prisma adapter for pagination keysets | none |
46
+ | `xantiagoma/web` | Browser/FormData utilities | none |
47
+ | `xantiagoma/ulid` | Prefixed ULID generation + helpers | `ulid` |
48
+ | `xantiagoma/temporal` | Date/time/duration + Temporal intervals | `@js-temporal/polyfill`, `itty-time` |
49
+ | `xantiagoma/dataloader` | DataLoader factory | `dataloader` |
50
+ | `xantiagoma/unstorage` | Cache helpers with unstorage | `unstorage`, `ohash` |
51
+ | `xantiagoma/valibot` | TimeZone validation schema | `valibot` |
52
+ | `xantiagoma/sonner` | Toast streaming for iterables | `sonner`, `react` |
53
+ | `xantiagoma/react` | React hooks + components | `react`, `@tanstack/react-query` |
46
54
 
47
55
  Sub-entry dependencies are **optional peer deps** — only install what you use.
48
56
 
@@ -114,6 +122,129 @@ Sub-entry dependencies are **optional peer deps** — only install what you use.
114
122
  | `resolveStreamSource` | Resolve `StreamSource<T>` | [src](./src/stream-source.ts) | [tests](./test/stream-source.test.ts) |
115
123
  | `secondsToMs` / `minutesToMs` / `hoursToMs` | Time unit converters | [src](./src/time-convert.ts) | [tests](./test/time-convert.test.ts) |
116
124
 
125
+ ## Interval Utilities (`xantiagoma/interval`)
126
+
127
+ A generic, immutable `Interval<T>` over any ordered type — modeled on Guava's
128
+ `Range` + `DiscreteDomain`. The engine knows nothing about `T` except through an
129
+ injected `IntervalDomain<T>` (compare, optional successor/measure/format/parse,
130
+ and the domain's `±∞` values). Zero dependencies. **Full guide:
131
+ [docs/INTERVAL.md](./docs/INTERVAL.md).**
132
+
133
+ ```ts
134
+ import { NumberInterval, IntegerInterval } from "xantiagoma/interval";
135
+
136
+ const r = new NumberInterval({ start: 0, startClose: true, end: 10, endClose: false }); // [0,10)
137
+ r.contains(5); // true
138
+ r.union(NumberInterval.closedOpen(10, 20))?.toString(); // "[0,20)"
139
+ NumberInterval.parse("(-Infinity,5]").contains(-3); // true
140
+
141
+ // discrete domains merge epsilon-adjacent ranges:
142
+ IntegerInterval.closed(1, 5).union(IntegerInterval.closed(6, 10))?.toString(); // "[1,10]"
143
+ ```
144
+
145
+ | Export | Description | Source | Tests |
146
+ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -------------------------------- | ---------------------------------------- |
147
+ | `Interval` | Immutable interval engine (set algebra over a domain) | [src](./src/interval.ts) | [tests](./test/interval.test.ts) |
148
+ | `defineIntervalType` | Bind a domain → `new`-able interval class + statics | [src](./src/interval.ts) | [tests](./test/interval.test.ts) |
149
+ | `parseInterval` / `mergeIntervals` | Parse `[a,b)` strings; merge a bag into disjoint pieces | [src](./src/interval.ts) | [tests](./test/interval.test.ts) |
150
+ | `numberDomain` / `integerDomain` / `bigIntDomain` / `dateDomain` / `stringDomain` | Built-in `IntervalDomain<T>`s (zero-dep) | [src](./src/interval-domains.ts) | [tests](./test/interval-domains.test.ts) |
151
+ | `NumberInterval` / `IntegerInterval` / `BigIntInterval` / `DateInterval` / `StringInterval` | Ready-to-use classes (incl. lexicographic strings) | [src](./src/interval-domains.ts) | [tests](./test/interval-domains.test.ts) |
152
+ | `createOrdinalInterval(labels)` | Discrete intervals over an ordered label list (enums) | [src](./src/interval-domains.ts) | [tests](./test/interval-domains.test.ts) |
153
+
154
+ **Temporal intervals** (`xantiagoma/temporal`, peer `@js-temporal/polyfill`) — the
155
+ same engine bound to the TC39 `Temporal` types:
156
+ `InstantInterval`, `ZonedDateTimeInterval`, `PlainDateInterval` (discrete, ε 1 day),
157
+ `PlainDateTimeInterval`, `PlainTimeInterval` (+ the matching `instantDomain` … exports).
158
+ Ordering/membership are nanosecond-exact; `length()`/`middle()` are millisecond-granular
159
+ (day-granular for `PlainDate`) — see [docs/INTERVAL.md](./docs/INTERVAL.md#temporal-intervals).
160
+
161
+ ```ts
162
+ import { PlainTimeInterval, InstantInterval } from "xantiagoma/temporal";
163
+ import { Temporal } from "@js-temporal/polyfill";
164
+
165
+ const shift = PlainTimeInterval.closedOpen(
166
+ Temporal.PlainTime.from("09:00"),
167
+ Temporal.PlainTime.from("17:00"),
168
+ );
169
+ shift.contains(Temporal.PlainTime.from("12:30")); // true
170
+ shift.length(); // 28_800_000 (ms = 8h)
171
+ ```
172
+
173
+ **Money intervals** (`xantiagoma/dinero`, peer `dinero.js`) — the engine bound to
174
+ dinero.js v2 values, **discrete** with the epsilon being one minor unit (1 cent for
175
+ USD, 1 yen for JPY) so adjacent ranges merge and `length()` counts amounts. Build a
176
+ class per currency with `createDineroInterval(currency)` — see
177
+ [docs/INTERVAL.md](./docs/INTERVAL.md#money-intervals).
178
+
179
+ ```ts
180
+ import { createDineroInterval } from "xantiagoma/dinero";
181
+ import { dinero, USD } from "dinero.js";
182
+
183
+ const UsdInterval = createDineroInterval(USD);
184
+ const tier = UsdInterval.closed(
185
+ dinero({ amount: 5_000, currency: USD }),
186
+ dinero({ amount: 10_000, currency: USD }),
187
+ );
188
+ tier.contains(dinero({ amount: 7_500, currency: USD })); // true ($75 ∈ [$50, $100])
189
+ tier.toString(); // "[5000,10000]" (minor units)
190
+ ```
191
+
192
+ **Decimal intervals** (`xantiagoma/decimal`, peer `decimal.js`) — an exact, continuous
193
+ alternative to `NumberInterval` when IEEE-754 float fuzz is unacceptable. Ordering,
194
+ membership, and the string form are exact arbitrary-precision; see
195
+ [docs/INTERVAL.md](./docs/INTERVAL.md#decimal-intervals).
196
+
197
+ ```ts
198
+ import { DecimalInterval } from "xantiagoma/decimal";
199
+ import Decimal from "decimal.js";
200
+
201
+ DecimalInterval.closed(new Decimal("0.1"), new Decimal("0.3")).length(); // 0.2 (not 0.19999999999999998)
202
+ DecimalInterval.closed(new Decimal("0.1"), new Decimal("0.3")).toString(); // "[0.1,0.3]"
203
+ ```
204
+
205
+ Same exact-decimal model, different backing library (pick the one you already use):
206
+ **`xantiagoma/big`** (`BigInterval`, peer `big.js` — smaller) and **`xantiagoma/bignumber`**
207
+ (`BigNumberInterval`, peer `bignumber.js`).
208
+
209
+ **Fraction intervals** (`xantiagoma/fraction`, peer `fraction.js`) — exact **rationals**:
210
+ `1/3` is lossless (never rounds, even where decimals can't) and renders as `"1/3"`. See
211
+ [docs/INTERVAL.md](./docs/INTERVAL.md#fraction-intervals).
212
+
213
+ ```ts
214
+ import { FractionInterval } from "xantiagoma/fraction";
215
+ import Fraction from "fraction.js";
216
+
217
+ const third = (n: number) => new Fraction(n, 3);
218
+ FractionInterval.closed(third(1), third(2)).toString(); // "[1/3,2/3]"
219
+ FractionInterval.closed(third(1), third(2)).contains(new Fraction(1, 2)); // true
220
+ ```
221
+
222
+ **Semver intervals** (`xantiagoma/semver`, peer `semver`) — a version range IS an interval
223
+ (`[">=1.2.0","<2.0.0")`). Exact precedence ordering; see
224
+ [docs/INTERVAL.md](./docs/INTERVAL.md#semver-intervals).
225
+
226
+ ```ts
227
+ import { SemverInterval } from "xantiagoma/semver";
228
+
229
+ const compatible = SemverInterval.closedOpen("1.2.0", "2.0.0");
230
+ compatible.contains("1.5.3"); // true
231
+ compatible.contains("2.0.0"); // false
232
+ ```
233
+
234
+ **IP intervals** (`xantiagoma/ip`, peer `ipaddr.js`) — IPv4/IPv6 ranges, discrete (ε = one
235
+ address), CIDR-aware. See [docs/INTERVAL.md](./docs/INTERVAL.md#ip-intervals).
236
+
237
+ ```ts
238
+ import { Ipv4Interval } from "xantiagoma/ip";
239
+
240
+ const lan = Ipv4Interval.cidr("192.168.0.0/16");
241
+ lan.contains(Ipv4Interval.ip("192.168.1.50")); // true
242
+ lan.length(); // 65536
243
+ ```
244
+
245
+ Strings and ordered enums need no extra dependency — `StringInterval` (lexicographic) and
246
+ `createOrdinalInterval([...])` (ordered labels) ship in `xantiagoma/interval`.
247
+
117
248
  ## Pagination Utilities (`xantiagoma/pagination`)
118
249
 
119
250
  Source-agnostic pagination: import from `xantiagoma/pagination`, provide fetchers for your data source (SQL, Drizzle, Prisma, Mongoose, HTTP...), and the paginator handles input styles (`page`/`pageSize`, `limit`/`offset`, cursor), `hasNextPage` lookahead, backward (scroll-up) pagination, and a uniform result envelope. **Full guide: [docs/PAGINATION.md](./docs/PAGINATION.md)** — backend recipes for SQL drivers, ORMs/query builders, Mongo, Firestore, DynamoDB, Redis sorted sets, Elasticsearch/OpenSearch, analytics warehouses, HTTP APIs, REST/GraphQL endpoints, cursor codecs, and frontend integration.
@@ -230,6 +361,13 @@ These are libraries we use and recommend. They're not re-exported — install th
230
361
  | [portakal](https://www.npmjs.com/package/portakal) | Printer / ESC/POS |
231
362
  | [hucre](https://www.npmjs.com/package/hucre) | Spreadsheet utilities |
232
363
  | [@gobrand/tiempo](https://www.npmjs.com/package/@gobrand/tiempo) | Time formatting / parsing |
364
+ | [dinero.js](https://dinerojs.com/) | Immutable, type-safe money handling |
365
+ | [decimal.js](https://github.com/MikeMcl/decimal.js) | Arbitrary-precision decimals |
366
+ | [big.js](https://github.com/MikeMcl/big.js) | Minimalist arbitrary-precision dec. |
367
+ | [bignumber.js](https://github.com/MikeMcl/bignumber.js) | Arbitrary-precision decimals/bases |
368
+ | [fraction.js](https://github.com/rawify/Fraction.js) | Exact rational numbers |
369
+ | [semver](https://github.com/npm/node-semver) | Semantic version parsing/compare |
370
+ | [ipaddr.js](https://github.com/whitequark/ipaddr.js) | IPv4/IPv6 address parsing |
233
371
  | [tactus](https://www.npmjs.com/package/tactus) | Haptic feedback for web |
234
372
  | [liveline](https://www.npmjs.com/package/liveline) | Animated line charts (React) |
235
373
  | [react-lzy-img](https://www.npmjs.com/package/react-lzy-img) | Lazy loading images (React) |
@@ -0,0 +1,40 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chunk = require("./chunk-CKQMccvm.cjs");
3
+ const require_interval = require("./interval-BsZKdewu.cjs");
4
+ let big_js = require("big.js");
5
+ big_js = require_chunk.__toESM(big_js, 1);
6
+ //#region src/interval-big.ts
7
+ /**
8
+ * Exact-decimal intervals backed by [big.js](https://github.com/MikeMcl/big.js) —
9
+ * a minimalist arbitrary-precision decimal. Same model as `xantiagoma/decimal`
10
+ * (decimal.js) but a much smaller dependency; pick whichever big-number library
11
+ * you already use. CONTINUOUS (decimals are dense). big.js is a **peer dependency**.
12
+ *
13
+ * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/
14
+ * `middle()` round-trip through a JS `number` (the engine's `measure` type).
15
+ * big.js values are always finite — it throws on `NaN`/`Infinity` construction —
16
+ * so there is no `isValid` guard.
17
+ */
18
+ /** Exact-decimal {@link IntervalDomain} backed by big.js. Continuous. */
19
+ const bigDomain = {
20
+ name: "big",
21
+ compare: (a, b) => a.cmp(b),
22
+ measure: (lower, upper) => upper.minus(lower).toNumber(),
23
+ add: (value, delta) => value.plus(delta),
24
+ format: (value) => value.toString(),
25
+ parse: (text) => new big_js.default(text)
26
+ };
27
+ /**
28
+ * Interval over big.js `Big` values — exact, continuous.
29
+ *
30
+ * import { BigInterval } from "xantiagoma/big";
31
+ * import Big from "big.js";
32
+ *
33
+ * BigInterval.closed(new Big("0.1"), new Big("0.3")).length(); // 0.2 (exact)
34
+ */
35
+ const BigInterval = require_interval.defineIntervalType(bigDomain);
36
+ //#endregion
37
+ exports.BigInterval = BigInterval;
38
+ exports.bigDomain = bigDomain;
39
+
40
+ //# sourceMappingURL=entry-big.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-big.cjs","names":["Big","defineIntervalType"],"sources":["../src/interval-big.ts"],"sourcesContent":["/**\n * Exact-decimal intervals backed by [big.js](https://github.com/MikeMcl/big.js) —\n * a minimalist arbitrary-precision decimal. Same model as `xantiagoma/decimal`\n * (decimal.js) but a much smaller dependency; pick whichever big-number library\n * you already use. CONTINUOUS (decimals are dense). big.js is a **peer dependency**.\n *\n * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/\n * `middle()` round-trip through a JS `number` (the engine's `measure` type).\n * big.js values are always finite — it throws on `NaN`/`Infinity` construction —\n * so there is no `isValid` guard.\n */\n\nimport Big from \"big.js\";\n\nimport { type BoundIntervalType, defineIntervalType, type IntervalDomain } from \"./interval.ts\";\n\ntype BigValue = InstanceType<typeof Big>;\n\n/** Exact-decimal {@link IntervalDomain} backed by big.js. Continuous. */\nexport const bigDomain: IntervalDomain<BigValue> = {\n name: \"big\",\n compare: (a, b) => a.cmp(b),\n measure: (lower, upper) => upper.minus(lower).toNumber(),\n add: (value, delta) => value.plus(delta),\n format: (value) => value.toString(),\n parse: (text) => new Big(text),\n};\n\n/**\n * Interval over big.js `Big` values — exact, continuous.\n *\n * import { BigInterval } from \"xantiagoma/big\";\n * import Big from \"big.js\";\n *\n * BigInterval.closed(new Big(\"0.1\"), new Big(\"0.3\")).length(); // 0.2 (exact)\n */\nexport const BigInterval: BoundIntervalType<BigValue> = defineIntervalType(bigDomain);\n/** Instance type of {@link BigInterval}. */\nexport type BigInterval = InstanceType<typeof BigInterval>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,YAAsC;CACjD,MAAM;CACN,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE;CAC3B,UAAU,OAAO,UAAU,MAAM,MAAM,MAAM,CAAC,UAAU;CACxD,MAAM,OAAO,UAAU,MAAM,KAAK,MAAM;CACxC,SAAS,UAAU,MAAM,UAAU;CACnC,QAAQ,SAAS,IAAIA,OAAAA,QAAI,KAAK;CAC/B;;;;;;;;;AAUD,MAAa,cAA2CC,iBAAAA,mBAAmB,UAAU"}
@@ -0,0 +1,21 @@
1
+ import { i as IntervalDomain, n as BoundIntervalType } from "./interval-Cz4Twj1-.cjs";
2
+ import Big from "big.js";
3
+
4
+ //#region src/interval-big.d.ts
5
+ type BigValue = InstanceType<typeof Big>;
6
+ /** Exact-decimal {@link IntervalDomain} backed by big.js. Continuous. */
7
+ declare const bigDomain: IntervalDomain<BigValue>;
8
+ /**
9
+ * Interval over big.js `Big` values — exact, continuous.
10
+ *
11
+ * import { BigInterval } from "xantiagoma/big";
12
+ * import Big from "big.js";
13
+ *
14
+ * BigInterval.closed(new Big("0.1"), new Big("0.3")).length(); // 0.2 (exact)
15
+ */
16
+ declare const BigInterval: BoundIntervalType<BigValue>;
17
+ /** Instance type of {@link BigInterval}. */
18
+ type BigInterval = InstanceType<typeof BigInterval>;
19
+ //#endregion
20
+ export { BigInterval, bigDomain };
21
+ //# sourceMappingURL=entry-big.d.cts.map
@@ -0,0 +1,21 @@
1
+ import { i as IntervalDomain, n as BoundIntervalType } from "./interval-D1wAtNyH.mjs";
2
+ import Big from "big.js";
3
+
4
+ //#region src/interval-big.d.ts
5
+ type BigValue = InstanceType<typeof Big>;
6
+ /** Exact-decimal {@link IntervalDomain} backed by big.js. Continuous. */
7
+ declare const bigDomain: IntervalDomain<BigValue>;
8
+ /**
9
+ * Interval over big.js `Big` values — exact, continuous.
10
+ *
11
+ * import { BigInterval } from "xantiagoma/big";
12
+ * import Big from "big.js";
13
+ *
14
+ * BigInterval.closed(new Big("0.1"), new Big("0.3")).length(); // 0.2 (exact)
15
+ */
16
+ declare const BigInterval: BoundIntervalType<BigValue>;
17
+ /** Instance type of {@link BigInterval}. */
18
+ type BigInterval = InstanceType<typeof BigInterval>;
19
+ //#endregion
20
+ export { BigInterval, bigDomain };
21
+ //# sourceMappingURL=entry-big.d.mts.map
@@ -0,0 +1,36 @@
1
+ import { n as defineIntervalType } from "./interval-C_s8UAce.mjs";
2
+ import Big from "big.js";
3
+ //#region src/interval-big.ts
4
+ /**
5
+ * Exact-decimal intervals backed by [big.js](https://github.com/MikeMcl/big.js) —
6
+ * a minimalist arbitrary-precision decimal. Same model as `xantiagoma/decimal`
7
+ * (decimal.js) but a much smaller dependency; pick whichever big-number library
8
+ * you already use. CONTINUOUS (decimals are dense). big.js is a **peer dependency**.
9
+ *
10
+ * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/
11
+ * `middle()` round-trip through a JS `number` (the engine's `measure` type).
12
+ * big.js values are always finite — it throws on `NaN`/`Infinity` construction —
13
+ * so there is no `isValid` guard.
14
+ */
15
+ /** Exact-decimal {@link IntervalDomain} backed by big.js. Continuous. */
16
+ const bigDomain = {
17
+ name: "big",
18
+ compare: (a, b) => a.cmp(b),
19
+ measure: (lower, upper) => upper.minus(lower).toNumber(),
20
+ add: (value, delta) => value.plus(delta),
21
+ format: (value) => value.toString(),
22
+ parse: (text) => new Big(text)
23
+ };
24
+ /**
25
+ * Interval over big.js `Big` values — exact, continuous.
26
+ *
27
+ * import { BigInterval } from "xantiagoma/big";
28
+ * import Big from "big.js";
29
+ *
30
+ * BigInterval.closed(new Big("0.1"), new Big("0.3")).length(); // 0.2 (exact)
31
+ */
32
+ const BigInterval = defineIntervalType(bigDomain);
33
+ //#endregion
34
+ export { BigInterval, bigDomain };
35
+
36
+ //# sourceMappingURL=entry-big.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-big.mjs","names":[],"sources":["../src/interval-big.ts"],"sourcesContent":["/**\n * Exact-decimal intervals backed by [big.js](https://github.com/MikeMcl/big.js) —\n * a minimalist arbitrary-precision decimal. Same model as `xantiagoma/decimal`\n * (decimal.js) but a much smaller dependency; pick whichever big-number library\n * you already use. CONTINUOUS (decimals are dense). big.js is a **peer dependency**.\n *\n * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/\n * `middle()` round-trip through a JS `number` (the engine's `measure` type).\n * big.js values are always finite — it throws on `NaN`/`Infinity` construction —\n * so there is no `isValid` guard.\n */\n\nimport Big from \"big.js\";\n\nimport { type BoundIntervalType, defineIntervalType, type IntervalDomain } from \"./interval.ts\";\n\ntype BigValue = InstanceType<typeof Big>;\n\n/** Exact-decimal {@link IntervalDomain} backed by big.js. Continuous. */\nexport const bigDomain: IntervalDomain<BigValue> = {\n name: \"big\",\n compare: (a, b) => a.cmp(b),\n measure: (lower, upper) => upper.minus(lower).toNumber(),\n add: (value, delta) => value.plus(delta),\n format: (value) => value.toString(),\n parse: (text) => new Big(text),\n};\n\n/**\n * Interval over big.js `Big` values — exact, continuous.\n *\n * import { BigInterval } from \"xantiagoma/big\";\n * import Big from \"big.js\";\n *\n * BigInterval.closed(new Big(\"0.1\"), new Big(\"0.3\")).length(); // 0.2 (exact)\n */\nexport const BigInterval: BoundIntervalType<BigValue> = defineIntervalType(bigDomain);\n/** Instance type of {@link BigInterval}. */\nexport type BigInterval = InstanceType<typeof BigInterval>;\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAa,YAAsC;CACjD,MAAM;CACN,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE;CAC3B,UAAU,OAAO,UAAU,MAAM,MAAM,MAAM,CAAC,UAAU;CACxD,MAAM,OAAO,UAAU,MAAM,KAAK,MAAM;CACxC,SAAS,UAAU,MAAM,UAAU;CACnC,QAAQ,SAAS,IAAI,IAAI,KAAK;CAC/B;;;;;;;;;AAUD,MAAa,cAA2C,mBAAmB,UAAU"}
@@ -0,0 +1,39 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./chunk-CKQMccvm.cjs");
3
+ const require_interval = require("./interval-BsZKdewu.cjs");
4
+ let bignumber_js = require("bignumber.js");
5
+ //#region src/interval-bignumber.ts
6
+ /**
7
+ * Exact-decimal intervals backed by [bignumber.js](https://github.com/MikeMcl/bignumber.js)
8
+ * — arbitrary-precision decimals with base conversion (popular in finance/crypto).
9
+ * Same model as `xantiagoma/decimal`; pick the big-number library you already use.
10
+ * CONTINUOUS (decimals are dense). bignumber.js is a **peer dependency**.
11
+ *
12
+ * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/
13
+ * `middle()` round-trip through a JS `number`. Members must be finite — `NaN`/
14
+ * `±Infinity` are rejected by `contains`.
15
+ */
16
+ /** Exact-decimal {@link IntervalDomain} backed by bignumber.js. Continuous; finite-only. */
17
+ const bigNumberDomain = {
18
+ name: "bignumber",
19
+ compare: (a, b) => a.comparedTo(b) ?? 0,
20
+ isValid: (value) => value.isFinite(),
21
+ measure: (lower, upper) => upper.minus(lower).toNumber(),
22
+ add: (value, delta) => value.plus(delta),
23
+ format: (value) => value.toString(),
24
+ parse: (text) => new bignumber_js.BigNumber(text)
25
+ };
26
+ /**
27
+ * Interval over bignumber.js `BigNumber` values — exact, continuous.
28
+ *
29
+ * import { BigNumberInterval } from "xantiagoma/bignumber";
30
+ * import { BigNumber } from "bignumber.js";
31
+ *
32
+ * BigNumberInterval.closed(new BigNumber("0.1"), new BigNumber("0.3")).length(); // 0.2 (exact)
33
+ */
34
+ const BigNumberInterval = require_interval.defineIntervalType(bigNumberDomain);
35
+ //#endregion
36
+ exports.BigNumberInterval = BigNumberInterval;
37
+ exports.bigNumberDomain = bigNumberDomain;
38
+
39
+ //# sourceMappingURL=entry-bignumber.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-bignumber.cjs","names":["BigNumber","defineIntervalType"],"sources":["../src/interval-bignumber.ts"],"sourcesContent":["/**\n * Exact-decimal intervals backed by [bignumber.js](https://github.com/MikeMcl/bignumber.js)\n * — arbitrary-precision decimals with base conversion (popular in finance/crypto).\n * Same model as `xantiagoma/decimal`; pick the big-number library you already use.\n * CONTINUOUS (decimals are dense). bignumber.js is a **peer dependency**.\n *\n * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/\n * `middle()` round-trip through a JS `number`. Members must be finite — `NaN`/\n * `±Infinity` are rejected by `contains`.\n */\n\nimport { BigNumber } from \"bignumber.js\";\n\nimport { type BoundIntervalType, defineIntervalType, type IntervalDomain } from \"./interval.ts\";\n\n/** Exact-decimal {@link IntervalDomain} backed by bignumber.js. Continuous; finite-only. */\nexport const bigNumberDomain: IntervalDomain<BigNumber> = {\n name: \"bignumber\",\n // comparedTo is null only when a NaN is involved; finite members never hit that.\n compare: (a, b) => a.comparedTo(b) ?? 0,\n isValid: (value) => value.isFinite(),\n measure: (lower, upper) => upper.minus(lower).toNumber(),\n add: (value, delta) => value.plus(delta),\n format: (value) => value.toString(),\n parse: (text) => new BigNumber(text),\n};\n\n/**\n * Interval over bignumber.js `BigNumber` values — exact, continuous.\n *\n * import { BigNumberInterval } from \"xantiagoma/bignumber\";\n * import { BigNumber } from \"bignumber.js\";\n *\n * BigNumberInterval.closed(new BigNumber(\"0.1\"), new BigNumber(\"0.3\")).length(); // 0.2 (exact)\n */\nexport const BigNumberInterval: BoundIntervalType<BigNumber> = defineIntervalType(bigNumberDomain);\n/** Instance type of {@link BigNumberInterval}. */\nexport type BigNumberInterval = InstanceType<typeof BigNumberInterval>;\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAA6C;CACxD,MAAM;CAEN,UAAU,GAAG,MAAM,EAAE,WAAW,EAAE,IAAI;CACtC,UAAU,UAAU,MAAM,UAAU;CACpC,UAAU,OAAO,UAAU,MAAM,MAAM,MAAM,CAAC,UAAU;CACxD,MAAM,OAAO,UAAU,MAAM,KAAK,MAAM;CACxC,SAAS,UAAU,MAAM,UAAU;CACnC,QAAQ,SAAS,IAAIA,aAAAA,UAAU,KAAK;CACrC;;;;;;;;;AAUD,MAAa,oBAAkDC,iBAAAA,mBAAmB,gBAAgB"}
@@ -0,0 +1,20 @@
1
+ import { i as IntervalDomain, n as BoundIntervalType } from "./interval-Cz4Twj1-.cjs";
2
+ import { BigNumber } from "bignumber.js";
3
+
4
+ //#region src/interval-bignumber.d.ts
5
+ /** Exact-decimal {@link IntervalDomain} backed by bignumber.js. Continuous; finite-only. */
6
+ declare const bigNumberDomain: IntervalDomain<BigNumber>;
7
+ /**
8
+ * Interval over bignumber.js `BigNumber` values — exact, continuous.
9
+ *
10
+ * import { BigNumberInterval } from "xantiagoma/bignumber";
11
+ * import { BigNumber } from "bignumber.js";
12
+ *
13
+ * BigNumberInterval.closed(new BigNumber("0.1"), new BigNumber("0.3")).length(); // 0.2 (exact)
14
+ */
15
+ declare const BigNumberInterval: BoundIntervalType<BigNumber>;
16
+ /** Instance type of {@link BigNumberInterval}. */
17
+ type BigNumberInterval = InstanceType<typeof BigNumberInterval>;
18
+ //#endregion
19
+ export { BigNumberInterval, bigNumberDomain };
20
+ //# sourceMappingURL=entry-bignumber.d.cts.map
@@ -0,0 +1,20 @@
1
+ import { i as IntervalDomain, n as BoundIntervalType } from "./interval-D1wAtNyH.mjs";
2
+ import { BigNumber } from "bignumber.js";
3
+
4
+ //#region src/interval-bignumber.d.ts
5
+ /** Exact-decimal {@link IntervalDomain} backed by bignumber.js. Continuous; finite-only. */
6
+ declare const bigNumberDomain: IntervalDomain<BigNumber>;
7
+ /**
8
+ * Interval over bignumber.js `BigNumber` values — exact, continuous.
9
+ *
10
+ * import { BigNumberInterval } from "xantiagoma/bignumber";
11
+ * import { BigNumber } from "bignumber.js";
12
+ *
13
+ * BigNumberInterval.closed(new BigNumber("0.1"), new BigNumber("0.3")).length(); // 0.2 (exact)
14
+ */
15
+ declare const BigNumberInterval: BoundIntervalType<BigNumber>;
16
+ /** Instance type of {@link BigNumberInterval}. */
17
+ type BigNumberInterval = InstanceType<typeof BigNumberInterval>;
18
+ //#endregion
19
+ export { BigNumberInterval, bigNumberDomain };
20
+ //# sourceMappingURL=entry-bignumber.d.mts.map
@@ -0,0 +1,36 @@
1
+ import { n as defineIntervalType } from "./interval-C_s8UAce.mjs";
2
+ import { BigNumber } from "bignumber.js";
3
+ //#region src/interval-bignumber.ts
4
+ /**
5
+ * Exact-decimal intervals backed by [bignumber.js](https://github.com/MikeMcl/bignumber.js)
6
+ * — arbitrary-precision decimals with base conversion (popular in finance/crypto).
7
+ * Same model as `xantiagoma/decimal`; pick the big-number library you already use.
8
+ * CONTINUOUS (decimals are dense). bignumber.js is a **peer dependency**.
9
+ *
10
+ * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/
11
+ * `middle()` round-trip through a JS `number`. Members must be finite — `NaN`/
12
+ * `±Infinity` are rejected by `contains`.
13
+ */
14
+ /** Exact-decimal {@link IntervalDomain} backed by bignumber.js. Continuous; finite-only. */
15
+ const bigNumberDomain = {
16
+ name: "bignumber",
17
+ compare: (a, b) => a.comparedTo(b) ?? 0,
18
+ isValid: (value) => value.isFinite(),
19
+ measure: (lower, upper) => upper.minus(lower).toNumber(),
20
+ add: (value, delta) => value.plus(delta),
21
+ format: (value) => value.toString(),
22
+ parse: (text) => new BigNumber(text)
23
+ };
24
+ /**
25
+ * Interval over bignumber.js `BigNumber` values — exact, continuous.
26
+ *
27
+ * import { BigNumberInterval } from "xantiagoma/bignumber";
28
+ * import { BigNumber } from "bignumber.js";
29
+ *
30
+ * BigNumberInterval.closed(new BigNumber("0.1"), new BigNumber("0.3")).length(); // 0.2 (exact)
31
+ */
32
+ const BigNumberInterval = defineIntervalType(bigNumberDomain);
33
+ //#endregion
34
+ export { BigNumberInterval, bigNumberDomain };
35
+
36
+ //# sourceMappingURL=entry-bignumber.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-bignumber.mjs","names":[],"sources":["../src/interval-bignumber.ts"],"sourcesContent":["/**\n * Exact-decimal intervals backed by [bignumber.js](https://github.com/MikeMcl/bignumber.js)\n * — arbitrary-precision decimals with base conversion (popular in finance/crypto).\n * Same model as `xantiagoma/decimal`; pick the big-number library you already use.\n * CONTINUOUS (decimals are dense). bignumber.js is a **peer dependency**.\n *\n * Ordering, membership, and `toString`/`parse` are exact; `measure`/`length()`/\n * `middle()` round-trip through a JS `number`. Members must be finite — `NaN`/\n * `±Infinity` are rejected by `contains`.\n */\n\nimport { BigNumber } from \"bignumber.js\";\n\nimport { type BoundIntervalType, defineIntervalType, type IntervalDomain } from \"./interval.ts\";\n\n/** Exact-decimal {@link IntervalDomain} backed by bignumber.js. Continuous; finite-only. */\nexport const bigNumberDomain: IntervalDomain<BigNumber> = {\n name: \"bignumber\",\n // comparedTo is null only when a NaN is involved; finite members never hit that.\n compare: (a, b) => a.comparedTo(b) ?? 0,\n isValid: (value) => value.isFinite(),\n measure: (lower, upper) => upper.minus(lower).toNumber(),\n add: (value, delta) => value.plus(delta),\n format: (value) => value.toString(),\n parse: (text) => new BigNumber(text),\n};\n\n/**\n * Interval over bignumber.js `BigNumber` values — exact, continuous.\n *\n * import { BigNumberInterval } from \"xantiagoma/bignumber\";\n * import { BigNumber } from \"bignumber.js\";\n *\n * BigNumberInterval.closed(new BigNumber(\"0.1\"), new BigNumber(\"0.3\")).length(); // 0.2 (exact)\n */\nexport const BigNumberInterval: BoundIntervalType<BigNumber> = defineIntervalType(bigNumberDomain);\n/** Instance type of {@link BigNumberInterval}. */\nexport type BigNumberInterval = InstanceType<typeof BigNumberInterval>;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAa,kBAA6C;CACxD,MAAM;CAEN,UAAU,GAAG,MAAM,EAAE,WAAW,EAAE,IAAI;CACtC,UAAU,UAAU,MAAM,UAAU;CACpC,UAAU,OAAO,UAAU,MAAM,MAAM,MAAM,CAAC,UAAU;CACxD,MAAM,OAAO,UAAU,MAAM,KAAK,MAAM;CACxC,SAAS,UAAU,MAAM,UAAU;CACnC,QAAQ,SAAS,IAAI,UAAU,KAAK;CACrC;;;;;;;;;AAUD,MAAa,oBAAkD,mBAAmB,gBAAgB"}
@@ -0,0 +1,47 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chunk = require("./chunk-CKQMccvm.cjs");
3
+ const require_interval = require("./interval-BsZKdewu.cjs");
4
+ let decimal_js = require("decimal.js");
5
+ decimal_js = require_chunk.__toESM(decimal_js, 1);
6
+ //#region src/interval-decimal.ts
7
+ /**
8
+ * Arbitrary-precision decimal intervals — the generic `Interval<T>` engine bound
9
+ * to [decimal.js](https://github.com/MikeMcl/decimal.js) `Decimal` values. Use
10
+ * this instead of `NumberInterval` when you need exact decimals and the IEEE-754
11
+ * float fuzz of `number` is unacceptable (e.g. `[0.1,0.3].length()` is `0.2`, not
12
+ * `0.19999999999999998`, and `toString()` is `"[0.1,0.3]"`).
13
+ *
14
+ * CONTINUOUS — decimals are dense, so there's no true successor (no `next`/`prev`).
15
+ * Ordering, membership, set operations, and parse/format are EXACT (backed by
16
+ * decimal.js). `measure`/`length()`/`middle()` round-trip through a JS `number`
17
+ * (the engine's `measure` return type), so the *result* of a measure is a double —
18
+ * but it's computed exactly first, so clean decimals stay clean. decimal.js is a
19
+ * **peer dependency**.
20
+ */
21
+ /** Exact-decimal {@link IntervalDomain} backed by decimal.js. Continuous; finite-only. */
22
+ const decimalDomain = {
23
+ name: "decimal",
24
+ compare: (a, b) => a.cmp(b),
25
+ isValid: (value) => value.isFinite(),
26
+ measure: (lower, upper) => upper.minus(lower).toNumber(),
27
+ add: (value, delta) => value.plus(delta),
28
+ format: (value) => value.toString(),
29
+ parse: (text) => new decimal_js.default(text)
30
+ };
31
+ /**
32
+ * Interval over decimal.js `Decimal` values — exact, continuous.
33
+ *
34
+ * import { DecimalInterval } from "xantiagoma/decimal";
35
+ * import Decimal from "decimal.js";
36
+ *
37
+ * const r = DecimalInterval.closed(new Decimal("0.1"), new Decimal("0.3"));
38
+ * r.length(); // 0.2 (exact — no float fuzz)
39
+ * r.toString(); // "[0.1,0.3]"
40
+ * r.contains(new Decimal("0.2")); // true
41
+ */
42
+ const DecimalInterval = require_interval.defineIntervalType(decimalDomain);
43
+ //#endregion
44
+ exports.DecimalInterval = DecimalInterval;
45
+ exports.decimalDomain = decimalDomain;
46
+
47
+ //# sourceMappingURL=entry-decimal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-decimal.cjs","names":["Decimal","defineIntervalType"],"sources":["../src/interval-decimal.ts"],"sourcesContent":["/**\n * Arbitrary-precision decimal intervals — the generic `Interval<T>` engine bound\n * to [decimal.js](https://github.com/MikeMcl/decimal.js) `Decimal` values. Use\n * this instead of `NumberInterval` when you need exact decimals and the IEEE-754\n * float fuzz of `number` is unacceptable (e.g. `[0.1,0.3].length()` is `0.2`, not\n * `0.19999999999999998`, and `toString()` is `\"[0.1,0.3]\"`).\n *\n * CONTINUOUS — decimals are dense, so there's no true successor (no `next`/`prev`).\n * Ordering, membership, set operations, and parse/format are EXACT (backed by\n * decimal.js). `measure`/`length()`/`middle()` round-trip through a JS `number`\n * (the engine's `measure` return type), so the *result* of a measure is a double —\n * but it's computed exactly first, so clean decimals stay clean. decimal.js is a\n * **peer dependency**.\n */\n\nimport Decimal from \"decimal.js\";\n\nimport { type BoundIntervalType, defineIntervalType, type IntervalDomain } from \"./interval.ts\";\n\n/** Exact-decimal {@link IntervalDomain} backed by decimal.js. Continuous; finite-only. */\nexport const decimalDomain: IntervalDomain<Decimal> = {\n name: \"decimal\",\n compare: (a, b) => a.cmp(b),\n isValid: (value) => value.isFinite(),\n measure: (lower, upper) => upper.minus(lower).toNumber(),\n add: (value, delta) => value.plus(delta),\n format: (value) => value.toString(),\n parse: (text) => new Decimal(text),\n};\n\n/**\n * Interval over decimal.js `Decimal` values — exact, continuous.\n *\n * import { DecimalInterval } from \"xantiagoma/decimal\";\n * import Decimal from \"decimal.js\";\n *\n * const r = DecimalInterval.closed(new Decimal(\"0.1\"), new Decimal(\"0.3\"));\n * r.length(); // 0.2 (exact — no float fuzz)\n * r.toString(); // \"[0.1,0.3]\"\n * r.contains(new Decimal(\"0.2\")); // true\n */\nexport const DecimalInterval: BoundIntervalType<Decimal> = defineIntervalType(decimalDomain);\n/** Instance type of {@link DecimalInterval}. */\nexport type DecimalInterval = InstanceType<typeof DecimalInterval>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,gBAAyC;CACpD,MAAM;CACN,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE;CAC3B,UAAU,UAAU,MAAM,UAAU;CACpC,UAAU,OAAO,UAAU,MAAM,MAAM,MAAM,CAAC,UAAU;CACxD,MAAM,OAAO,UAAU,MAAM,KAAK,MAAM;CACxC,SAAS,UAAU,MAAM,UAAU;CACnC,QAAQ,SAAS,IAAIA,WAAAA,QAAQ,KAAK;CACnC;;;;;;;;;;;;AAaD,MAAa,kBAA8CC,iBAAAA,mBAAmB,cAAc"}
@@ -0,0 +1,23 @@
1
+ import { i as IntervalDomain, n as BoundIntervalType } from "./interval-Cz4Twj1-.cjs";
2
+ import Decimal from "decimal.js";
3
+
4
+ //#region src/interval-decimal.d.ts
5
+ /** Exact-decimal {@link IntervalDomain} backed by decimal.js. Continuous; finite-only. */
6
+ declare const decimalDomain: IntervalDomain<Decimal>;
7
+ /**
8
+ * Interval over decimal.js `Decimal` values — exact, continuous.
9
+ *
10
+ * import { DecimalInterval } from "xantiagoma/decimal";
11
+ * import Decimal from "decimal.js";
12
+ *
13
+ * const r = DecimalInterval.closed(new Decimal("0.1"), new Decimal("0.3"));
14
+ * r.length(); // 0.2 (exact — no float fuzz)
15
+ * r.toString(); // "[0.1,0.3]"
16
+ * r.contains(new Decimal("0.2")); // true
17
+ */
18
+ declare const DecimalInterval: BoundIntervalType<Decimal>;
19
+ /** Instance type of {@link DecimalInterval}. */
20
+ type DecimalInterval = InstanceType<typeof DecimalInterval>;
21
+ //#endregion
22
+ export { DecimalInterval, decimalDomain };
23
+ //# sourceMappingURL=entry-decimal.d.cts.map
@@ -0,0 +1,23 @@
1
+ import { i as IntervalDomain, n as BoundIntervalType } from "./interval-D1wAtNyH.mjs";
2
+ import Decimal from "decimal.js";
3
+
4
+ //#region src/interval-decimal.d.ts
5
+ /** Exact-decimal {@link IntervalDomain} backed by decimal.js. Continuous; finite-only. */
6
+ declare const decimalDomain: IntervalDomain<Decimal>;
7
+ /**
8
+ * Interval over decimal.js `Decimal` values — exact, continuous.
9
+ *
10
+ * import { DecimalInterval } from "xantiagoma/decimal";
11
+ * import Decimal from "decimal.js";
12
+ *
13
+ * const r = DecimalInterval.closed(new Decimal("0.1"), new Decimal("0.3"));
14
+ * r.length(); // 0.2 (exact — no float fuzz)
15
+ * r.toString(); // "[0.1,0.3]"
16
+ * r.contains(new Decimal("0.2")); // true
17
+ */
18
+ declare const DecimalInterval: BoundIntervalType<Decimal>;
19
+ /** Instance type of {@link DecimalInterval}. */
20
+ type DecimalInterval = InstanceType<typeof DecimalInterval>;
21
+ //#endregion
22
+ export { DecimalInterval, decimalDomain };
23
+ //# sourceMappingURL=entry-decimal.d.mts.map
@@ -0,0 +1,43 @@
1
+ import { n as defineIntervalType } from "./interval-C_s8UAce.mjs";
2
+ import Decimal from "decimal.js";
3
+ //#region src/interval-decimal.ts
4
+ /**
5
+ * Arbitrary-precision decimal intervals — the generic `Interval<T>` engine bound
6
+ * to [decimal.js](https://github.com/MikeMcl/decimal.js) `Decimal` values. Use
7
+ * this instead of `NumberInterval` when you need exact decimals and the IEEE-754
8
+ * float fuzz of `number` is unacceptable (e.g. `[0.1,0.3].length()` is `0.2`, not
9
+ * `0.19999999999999998`, and `toString()` is `"[0.1,0.3]"`).
10
+ *
11
+ * CONTINUOUS — decimals are dense, so there's no true successor (no `next`/`prev`).
12
+ * Ordering, membership, set operations, and parse/format are EXACT (backed by
13
+ * decimal.js). `measure`/`length()`/`middle()` round-trip through a JS `number`
14
+ * (the engine's `measure` return type), so the *result* of a measure is a double —
15
+ * but it's computed exactly first, so clean decimals stay clean. decimal.js is a
16
+ * **peer dependency**.
17
+ */
18
+ /** Exact-decimal {@link IntervalDomain} backed by decimal.js. Continuous; finite-only. */
19
+ const decimalDomain = {
20
+ name: "decimal",
21
+ compare: (a, b) => a.cmp(b),
22
+ isValid: (value) => value.isFinite(),
23
+ measure: (lower, upper) => upper.minus(lower).toNumber(),
24
+ add: (value, delta) => value.plus(delta),
25
+ format: (value) => value.toString(),
26
+ parse: (text) => new Decimal(text)
27
+ };
28
+ /**
29
+ * Interval over decimal.js `Decimal` values — exact, continuous.
30
+ *
31
+ * import { DecimalInterval } from "xantiagoma/decimal";
32
+ * import Decimal from "decimal.js";
33
+ *
34
+ * const r = DecimalInterval.closed(new Decimal("0.1"), new Decimal("0.3"));
35
+ * r.length(); // 0.2 (exact — no float fuzz)
36
+ * r.toString(); // "[0.1,0.3]"
37
+ * r.contains(new Decimal("0.2")); // true
38
+ */
39
+ const DecimalInterval = defineIntervalType(decimalDomain);
40
+ //#endregion
41
+ export { DecimalInterval, decimalDomain };
42
+
43
+ //# sourceMappingURL=entry-decimal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-decimal.mjs","names":[],"sources":["../src/interval-decimal.ts"],"sourcesContent":["/**\n * Arbitrary-precision decimal intervals — the generic `Interval<T>` engine bound\n * to [decimal.js](https://github.com/MikeMcl/decimal.js) `Decimal` values. Use\n * this instead of `NumberInterval` when you need exact decimals and the IEEE-754\n * float fuzz of `number` is unacceptable (e.g. `[0.1,0.3].length()` is `0.2`, not\n * `0.19999999999999998`, and `toString()` is `\"[0.1,0.3]\"`).\n *\n * CONTINUOUS — decimals are dense, so there's no true successor (no `next`/`prev`).\n * Ordering, membership, set operations, and parse/format are EXACT (backed by\n * decimal.js). `measure`/`length()`/`middle()` round-trip through a JS `number`\n * (the engine's `measure` return type), so the *result* of a measure is a double —\n * but it's computed exactly first, so clean decimals stay clean. decimal.js is a\n * **peer dependency**.\n */\n\nimport Decimal from \"decimal.js\";\n\nimport { type BoundIntervalType, defineIntervalType, type IntervalDomain } from \"./interval.ts\";\n\n/** Exact-decimal {@link IntervalDomain} backed by decimal.js. Continuous; finite-only. */\nexport const decimalDomain: IntervalDomain<Decimal> = {\n name: \"decimal\",\n compare: (a, b) => a.cmp(b),\n isValid: (value) => value.isFinite(),\n measure: (lower, upper) => upper.minus(lower).toNumber(),\n add: (value, delta) => value.plus(delta),\n format: (value) => value.toString(),\n parse: (text) => new Decimal(text),\n};\n\n/**\n * Interval over decimal.js `Decimal` values — exact, continuous.\n *\n * import { DecimalInterval } from \"xantiagoma/decimal\";\n * import Decimal from \"decimal.js\";\n *\n * const r = DecimalInterval.closed(new Decimal(\"0.1\"), new Decimal(\"0.3\"));\n * r.length(); // 0.2 (exact — no float fuzz)\n * r.toString(); // \"[0.1,0.3]\"\n * r.contains(new Decimal(\"0.2\")); // true\n */\nexport const DecimalInterval: BoundIntervalType<Decimal> = defineIntervalType(decimalDomain);\n/** Instance type of {@link DecimalInterval}. */\nexport type DecimalInterval = InstanceType<typeof DecimalInterval>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAa,gBAAyC;CACpD,MAAM;CACN,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE;CAC3B,UAAU,UAAU,MAAM,UAAU;CACpC,UAAU,OAAO,UAAU,MAAM,MAAM,MAAM,CAAC,UAAU;CACxD,MAAM,OAAO,UAAU,MAAM,KAAK,MAAM;CACxC,SAAS,UAAU,MAAM,UAAU;CACnC,QAAQ,SAAS,IAAI,QAAQ,KAAK;CACnC;;;;;;;;;;;;AAaD,MAAa,kBAA8C,mBAAmB,cAAc"}