@sheetxl/primitives 0.7.21 → 0.7.23-beta.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.
Files changed (45) hide show
  1. package/browser/cjs/index.cjs +1 -6
  2. package/browser/esm/index.mjs +683 -307
  3. package/node/esm/index.mjs +684 -307
  4. package/package.json +1 -1
  5. package/types/index.d.ts +2 -1622
  6. package/types/src/ErrorPolicy.d.ts +78 -0
  7. package/types/src/ErrorPolicy.d.ts.map +1 -0
  8. package/types/src/Flatten.d.ts +34 -0
  9. package/types/src/Flatten.d.ts.map +1 -0
  10. package/types/src/FormulaContext.d.ts +227 -0
  11. package/types/src/FormulaContext.d.ts.map +1 -0
  12. package/types/src/FormulaError.d.ts +328 -0
  13. package/types/src/FormulaError.d.ts.map +1 -0
  14. package/types/src/IFormulaContext.d.ts +533 -0
  15. package/types/src/IFormulaContext.d.ts.map +1 -0
  16. package/types/src/IFunction.d.ts +608 -0
  17. package/types/src/IFunction.d.ts.map +1 -0
  18. package/types/src/IRange.d.ts +1091 -0
  19. package/types/src/IRange.d.ts.map +1 -0
  20. package/types/src/IRangeStats.d.ts +478 -0
  21. package/types/src/IRangeStats.d.ts.map +1 -0
  22. package/types/src/IReferenceRange.d.ts +22 -0
  23. package/types/src/IReferenceRange.d.ts.map +1 -0
  24. package/types/src/IRichData.d.ts +37 -0
  25. package/types/src/IRichData.d.ts.map +1 -0
  26. package/types/src/IRuntime.d.ts +65 -0
  27. package/types/src/IRuntime.d.ts.map +1 -0
  28. package/types/src/Lambda.d.ts +17 -0
  29. package/types/src/Lambda.d.ts.map +1 -0
  30. package/types/src/LocaleProfile.d.ts +79 -0
  31. package/types/src/LocaleProfile.d.ts.map +1 -0
  32. package/types/src/Observable.d.ts +46 -0
  33. package/types/src/Observable.d.ts.map +1 -0
  34. package/types/src/Omittable.d.ts +50 -0
  35. package/types/src/Omittable.d.ts.map +1 -0
  36. package/types/src/Repeating.d.ts +66 -0
  37. package/types/src/Repeating.d.ts.map +1 -0
  38. package/types/src/Scalar.d.ts +67 -0
  39. package/types/src/Scalar.d.ts.map +1 -0
  40. package/types/src/ScalarType.d.ts +109 -0
  41. package/types/src/ScalarType.d.ts.map +1 -0
  42. package/types/src/WildCard.d.ts +26 -0
  43. package/types/src/WildCard.d.ts.map +1 -0
  44. package/types/src/index.d.ts +20 -0
  45. package/types/src/index.d.ts.map +1 -0
@@ -0,0 +1,79 @@
1
+ /** 0=Sun..6=Sat */
2
+ export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
3
+ export type CurrencyDisplay = "symbol" | "code" | "name";
4
+ export type CurrencyPosition = "before" | "after";
5
+ export type CurrencySpacing = "tight" | "space";
6
+ /**
7
+ * Everything regional behavior depends on, resolved for a single locale.
8
+ *
9
+ * @remarks
10
+ * This is the one source of truth for separators, date patterns, currency, and
11
+ * collation. It is derived data -- the identity is the BCP 47 tag, which is what
12
+ * a workbook persists.
13
+ */
14
+ export interface LocaleProfile {
15
+ /** The BCP 47 tag this profile was resolved from, e.g. `de-DE`. */
16
+ tag: string;
17
+ numberingSystem: string;
18
+ decimal: string;
19
+ group: string;
20
+ /** e.g. `[3]`, or `[3,2]` for hi-IN. */
21
+ grouping: number[];
22
+ minusSign: string;
23
+ percentSign: string;
24
+ /** usually `‰` */
25
+ permilleSign: string;
26
+ /** ISO 4217 code for the region, e.g. `EUR`. */
27
+ currencyCode: string;
28
+ /** The rendered symbol for {@link LocaleProfile.currencyCode}, e.g. `€`. */
29
+ currencySymbol: string;
30
+ currencyDisplay: CurrencyDisplay;
31
+ currencyPosition: CurrencyPosition;
32
+ currencySpacing: CurrencySpacing;
33
+ date: {
34
+ /** e.g. `gregory` */
35
+ calendar: string;
36
+ /** e.g. `M/d/yy` */
37
+ short: string;
38
+ /** e.g. `MMM d, y` */
39
+ medium: string;
40
+ /** e.g. `MMMM d, y` */
41
+ long: string;
42
+ /** e.g. `h:mm a` or `HH:mm` */
43
+ timeShort: string;
44
+ /** e.g. `h:mm:ss a z` -- note: `z` is a hint only */
45
+ timeLong: string;
46
+ am?: string;
47
+ pm?: string;
48
+ firstDay: DayOfWeek;
49
+ weekend: [DayOfWeek, DayOfWeek];
50
+ monthsWide: string[];
51
+ monthsAbbr: string[];
52
+ weekdaysWide: string[];
53
+ weekdaysAbbr: string[];
54
+ hour12: boolean;
55
+ };
56
+ /** Function/list argument separator, like Excel (`,` or `;`). */
57
+ listSeparator: string;
58
+ csvDelimiter: string;
59
+ rtl: boolean;
60
+ /** Collation defaults for sorting. */
61
+ collator: Intl.CollatorOptions;
62
+ }
63
+ /**
64
+ * A patch over an `Intl`-derived {@link LocaleProfile} — the regional-override escape
65
+ * hatch. Excel/Windows honor OS regional *customizations* (a custom decimal symbol,
66
+ * a different currency) that browser `Intl` cannot see; a workbook may persist
67
+ * `{ tag, overrides? }` to reproduce them.
68
+ *
69
+ * @remarks
70
+ * Overrides are applied **literally** on top of the derived profile — nothing is
71
+ * re-derived. In particular {@link LocaleProfile.listSeparator} /
72
+ * {@link LocaleProfile.csvDelimiter} are normally derived from `decimal`, so patch
73
+ * them too if you patch `decimal`. The `date` sub-object merges one level deep; the
74
+ * `tag` is the identity and cannot be overridden.
75
+ */
76
+ export type LocaleProfileOverrides = Partial<Omit<LocaleProfile, 'tag' | 'date'>> & {
77
+ date?: Partial<LocaleProfile['date']>;
78
+ };
79
+ //# sourceMappingURL=LocaleProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocaleProfile.d.ts","sourceRoot":"","sources":["../../../src/LocaleProfile.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,MAAM,MAAM,SAAS,GAAG,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,CAAC;AACtC,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IAGxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,YAAY,EAAE,MAAM,CAAC;IAErB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;IACjC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IAGjC,IAAI,EAAE;QACJ,qBAAqB;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,oBAAoB;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,sBAAsB;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,uBAAuB;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,+BAA+B;QAC/B,SAAS,EAAE,MAAM,CAAC;QAClB,qDAAqD;QACrD,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,SAAS,CAAC;QACpB,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChC,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;IAGF,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,OAAO,CAAC;IAEb,sCAAsC;IACtC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,sBAAsB,GAChC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,GAAG;IAC7C,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;CACvC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * An object interface that defines a set of callback functions a user can use to get
3
+ * notified of any set of {@link Observable}.
4
+ *
5
+ * @see {@link https://rxjs.dev/api/index/class/Observable | Observable}
6
+ */
7
+ export declare class Observable<T = any> {
8
+ protected _subscribeFn: (subscriber: Subscriber<T>) => () => void;
9
+ constructor(subscribeFn: (subscriber: Subscriber<T>) => () => void);
10
+ subscribe(next: any, error: (err: any) => void, complete: () => void): {
11
+ next: any;
12
+ error: any;
13
+ complete: any;
14
+ unsubscribe: () => void;
15
+ };
16
+ }
17
+ /**
18
+ * An object interface that defines a set of callback functions a user can use to get
19
+ * notified of any set of {@link Observable}.
20
+ */
21
+ export interface Subscriber<T> {
22
+ /**
23
+ * A callback function that gets called by the producer during the subscription when
24
+ * the producer "has" the `value`. It won't be called if `error` or `complete` callback
25
+ * functions have been called, nor after the consumer has unsubscribed.
26
+ */
27
+ next: (value: T) => void;
28
+ /**
29
+ * A callback function that gets called by the producer if and when it encountered a
30
+ * problem of any kind. The errored value will be provided through the `err` parameter.
31
+ * This callback can't be called more than one time, it can't be called if the
32
+ * `complete` callback function have been called previously, nor it can't be called if
33
+ * the consumer has unsubscribed.
34
+ */
35
+ error: (err: any) => void;
36
+ /**
37
+ * A callback function that gets called by the producer if and when it has no more
38
+ * values to provide (by calling `next` callback function). This means that no error
39
+ * has happened. This callback can't be called more than one time, it can't be called
40
+ * if the `error` callback function have been called previously, nor it can't be called
41
+ * if the consumer has unsubscribed.
42
+ */
43
+ complete: () => void;
44
+ unsubscribe: () => void;
45
+ }
46
+ //# sourceMappingURL=Observable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Observable.d.ts","sourceRoot":"","sources":["../../../src/Observable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,UAAU,CAAC,CAAC,GAAC,GAAG;IAC3B,SAAS,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC;gBACtD,WAAW,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI;IAIlE,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI;;;;;;CA8BrE;AAGD;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACzB;;;;;;OAMG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Declares what a parameter means when the caller supplies it EMPTY — `FIXED(1.5,)`, a comma with
3
+ * nothing before it.
4
+ *
5
+ * @remarks
6
+ * A spreadsheet argument has three positions rather than two, and each carries its own meaning:
7
+ *
8
+ * | call | position | the parameter receives |
9
+ * | --- | --- | --- |
10
+ * | `FIXED(1.5)` | absent | nothing, so the parameter's own initializer applies |
11
+ * | `FIXED(1.5,)` | omitted | whatever this marker declares |
12
+ * | `FIXED(1.5,E1)` | a blank cell | the value `0` / `false` / `""` |
13
+ *
14
+ * The last row is why omission needs a declaration of its own. A blank cell is a VALUE the caller
15
+ * supplied and coerces like any other, so "empty" cannot simply mean "unspecified" everywhere —
16
+ * and functions disagree about which of the two an empty comma resembles.
17
+ *
18
+ * Undeclared, an omitted argument coerces exactly as a blank cell does. Declared, it means `V`
19
+ * where one is given, and otherwise means whatever an absent argument means.
20
+ *
21
+ * @typeParam T - the parameter's type; the marker is otherwise transparent.
22
+ * @typeParam V - what an omitted argument means, where that differs from the absent default.
23
+ *
24
+ * @example An omitted argument means the default, and one initializer serves both positions.
25
+ * ```ts
26
+ * export function FIXED(number: number, decimals: Omittable<number> = 2): string
27
+ * ```
28
+ *
29
+ * @example An omitted argument means something else, so both values are spelled out.
30
+ * ```ts
31
+ * // absent is 1 (approximate); omitted is 0 (exact)
32
+ * export function MATCH(lookupValue: IRange, lookupArray: IRange,
33
+ * matchType: Omittable<number, 0> = 1): Scalar
34
+ * ```
35
+ *
36
+ * @example An omitted argument is not a value at all, and the body answers for it. Without an
37
+ * initializer to fall back on, the parameter is REQUIRED and the omission reaches it as
38
+ * `undefined` — which is a different thing from the `null` a blank cell coerces to.
39
+ * ```ts
40
+ * export function WEEKNUM(serialNumber: Omittable<Scalar>, returnType: Omittable<Scalar> = 1): number
41
+ * ```
42
+ *
43
+ * Supplying `V` leaves the parameter's type untouched; leaving it off adds `undefined`, so a
44
+ * declaration carrying an initializer sees a plain `T` while one without it is made to handle the
45
+ * omission.
46
+ *
47
+ * @see {@link IFunction.ParameterTypeJSON.omittable}
48
+ */
49
+ export type Omittable<T, V = never> = [V] extends [never] ? T | undefined : T;
50
+ //# sourceMappingURL=Omittable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Omittable.d.ts","sourceRoot":"","sources":["../../../src/Omittable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Declares a REPEATING PARAMETER GROUP: one declared parameter whose arguments arrive as a
3
+ * fixed-size cycle repeated N times. `SUMIFS(sum, r1, c1, r2, c2, …)` is one `sumRange` followed
4
+ * by a `[criteriaRange, criteria]` group repeated as many times as the caller supplied.
5
+ *
6
+ * At the type level it is `T[]`, so the body reads exactly what it is handed:
7
+ *
8
+ * | declaration | period | body receives |
9
+ * | --- | --- | --- |
10
+ * | `Repeating<[a: IRange, b: Scalar]>` | 2 | `[IRange, Scalar][]` |
11
+ * | `Repeating<IRange>` | 1 | `IRange[]` |
12
+ *
13
+ * **Period 1 is spelled without the tuple** — a one-element tuple is a compiler error, because
14
+ * `[IRange][]` and `IRange[]` would otherwise be two ways to say the same thing. A period-1 group
15
+ * takes its slot name from the parameter itself, so `array: Repeating<IRange>` shows as
16
+ * `array1, array2, …` — the same display a rest parameter gets, and the reason `Repeating` can
17
+ * replace the `first + ...rest` split that reads as `array, rest1, rest2`.
18
+ *
19
+ * ### Why this exists rather than a rest parameter
20
+ *
21
+ * `...rest: T[]` has ONE type for every trailing argument, so a period-2 group has to declare its
22
+ * slots as their union — which makes the criteria slots of pairs 2+ invisible to every consumer
23
+ * that reads the declaration per position. The implicit-intersection site predicate is the one
24
+ * that matters: it saw `SUMIFS`'s criteria as a range parameter and under-marked the formula.
25
+ * A group binds argument `i` to slot `(i − prefix) % period`, so every repetition types the same
26
+ * as the first.
27
+ *
28
+ * A group also carries a real MINIMUM: at least one repetition is required. That is the whole
29
+ * difference from a rest parameter, which is 0-or-more and remains the spelling for it:
30
+ *
31
+ * ```ts
32
+ * ...x: T[] // 0 or more
33
+ * x: T[] // 1 or more (a period-1 group; an array IS a repeat of one)
34
+ * x: Repeating<[a: A, b: B]> // 1 or more, period 2+
35
+ * ```
36
+ *
37
+ * So `x?: T[]` is refused — it would be a second way to say `...x: T[]`.
38
+ *
39
+ * ### Arity is arithmetic, never type-directed
40
+ *
41
+ * `n = (argc − prefix − suffix) / period`, and a non-zero remainder is an error.
42
+ *
43
+ * ### The one short form
44
+ *
45
+ * The LAST slot of a group may be declared optional, which means exactly one thing: it may be
46
+ * omitted when there is a single repetition. `SORTBY`'s legal arities are 2 and 1+2n and nothing
47
+ * else — `SORTBY(array, by1)` is legal, `SORTBY(array, by1, o1, by2)` is not. It is not a general
48
+ * "the final element of the final group may be omitted" rule; that rule would accept a formula
49
+ * Excel refuses. An optional slot anywhere else in the group is a compiler error.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * export function SUMIFS(
54
+ * sumRange: AcceptError<IRange>,
55
+ * criteria: Repeating<[criteriaRange: AcceptError<IReferenceRange>, criteria: AcceptError<IRange>]>
56
+ * ): IRange {
57
+ * for (const [range, test] of criteria) { ... }
58
+ * }
59
+ *
60
+ * export function HSTACK(array: Repeating<AcceptError<IRange>>): IRange {
61
+ * return array.reduce((acc, next) => acc.concat(next, IRange.Axis.Column));
62
+ * }
63
+ * ```
64
+ */
65
+ export type Repeating<T> = T[];
66
+ //# sourceMappingURL=Repeating.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Repeating.d.ts","sourceRoot":"","sources":["../../../src/Repeating.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { FormulaError } from './FormulaError';
2
+ import { IRichData } from './IRichData';
3
+ /**
4
+ * The fundamental value type of the spreadsheet engine.
5
+ *
6
+ * `Scalar` is what cells hold and what formula functions receive and return.
7
+ * It covers every native spreadsheet type — numbers (including dates, which
8
+ * are stored as serial numbers), strings, booleans, errors, rich data objects,
9
+ * and blank (`null`).
10
+ *
11
+ * Use `Scalar` wherever a value could be any cell-compatible type. When you
12
+ * need to accept a JavaScript `Date` at an API boundary, use {@link InteropScalar}
13
+ * instead.
14
+ *
15
+ * @remarks
16
+ * Dates are not a distinct `Scalar` variant — they are numbers with a format
17
+ * applied. `FormulaContext.parseAsDate` / `toSerialDate` convert between the
18
+ * two representations.
19
+ *
20
+ * @see {@link InteropScalar} for a version that includes `Date`.
21
+ * @see {@link ScalarType} for the companion enum that identifies which variant a value is.
22
+ */
23
+ export type Scalar = number | boolean | string | FormulaError.Known | IRichData | null;
24
+ export declare namespace Scalar {
25
+ /**
26
+ * The most characters a text scalar (and therefore a cell) can hold.
27
+ */
28
+ const MAX_TEXT_LENGTH = 32767;
29
+ /**
30
+ * The most significant digits a number parsed FROM TEXT can carry.
31
+ */
32
+ const MAX_SIGNIFICANT_DIGITS = 15;
33
+ /**
34
+ * Applies Excel's entry rule to numeric text: every significand digit past the
35
+ * 15th becomes `0`, so the text parses to the double Excel would store.
36
+ *
37
+ * @param text Numeric text in any accepted form — signed, grouped, percent,
38
+ * currency-affixed, or scientific. The scan is locale-blind: only digit
39
+ * characters count toward significance (separators pass through untouched),
40
+ * leading zeros carry none, and the scan stops at an exponent marker so `E5`
41
+ * keeps its magnitude. Excess digits are zeroed rather than dropped so the
42
+ * text's shape (decimal places, grouping) survives for format inference.
43
+ *
44
+ * @remarks
45
+ * Callers apply this to every text→number path and to nothing else — measured
46
+ * truncation, not rounding: `1234567890.123456789` stores `…345`, never `…346`.
47
+ */
48
+ function truncateNumberText(text: string): string;
49
+ }
50
+ /**
51
+ * Represents a cell value in JavaScript, including `Date` for convenience.
52
+ *
53
+ * Extends `Scalar` to support `Date`.
54
+ *
55
+ * @remarks
56
+ * ** IMPORTANT** Spreadsheets store dates internally as serial numbers (SerialDates) to optimize calculation performance. These are integer values representing
57
+ * the number of days since either January 1, 1900, or January 1, 1904, depending on the container's settings.
58
+ *
59
+ * For type-safe date retrieval consider using the method, which returns null if the cell value is not a valid date.
60
+ *
61
+ * @see
62
+ * Refer to the following resources for more details:
63
+ * * {@link https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487 | Date systems in Excel}
64
+ * * {@link https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tooadate?view=net-8.0 | DateTime.ToSerialDate Method}
65
+ */
66
+ export type InteropScalar = Scalar | Date;
67
+ //# sourceMappingURL=Scalar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scalar.d.ts","sourceRoot":"","sources":["../../../src/Scalar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC;AAEvF,yBAAiB,MAAM,CAAC;IACtB;;OAEG;IACI,MAAM,eAAe,QAAQ,CAAC;IAErC;;OAEG;IACI,MAAM,sBAAsB,KAAK,CAAC;IAEzC;;;;;;;;;;;;;;OAcG;IACH,SAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBvD;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,IAAI,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Identifies which variant of {@link Scalar} a cell value is.
3
+ *
4
+ * Because `Scalar` is a union type, `ScalarType` gives you a safe, string-based
5
+ * discriminant for branching on value kind — useful in formula implementations,
6
+ * data-profiling UIs, and type-coercion logic without relying on `typeof` or
7
+ * `instanceof` checks that do not cover all cases (e.g. `null`, `FormulaError`,
8
+ * `IRichData`).
9
+ *
10
+ * @remarks
11
+ * Dates have no dedicated variant. They are stored as `Number` values with a
12
+ * number format applied. Use `FormulaContext.isValidDate` to distinguish them
13
+ * at runtime. `InteropScalarType` extends this enum with a `Date` variant for
14
+ * API boundaries that accept JavaScript `Date` objects.
15
+ *
16
+ * @see {@link Scalar} for the value type this enum describes.
17
+ * @see {@link InteropScalarType} for the superset that includes `Date`.
18
+ */
19
+ export declare const ScalarType: {
20
+ /**
21
+ * A numeric value.
22
+ *
23
+ * @remarks
24
+ * Dates are expressed as formatted numbers within cells. They are internally stored as
25
+ * serial numbers and can be formatted to display as dates.
26
+ */
27
+ readonly Number: "number";
28
+ /**
29
+ * A string value.
30
+ */
31
+ readonly String: "string";
32
+ /**
33
+ * A boolean value (`true` or `false`).
34
+ */
35
+ readonly Boolean: "boolean";
36
+ /**
37
+ * A cell that contains an error value.
38
+ *
39
+ * @remarks
40
+ * Error cells represent cells where an error occurred during formula evaluation or data processing.
41
+ */
42
+ readonly Error: "error";
43
+ /**
44
+ * A complex data type represented as {@link IRichData}.
45
+ *
46
+ * @remarks
47
+ * Rich data are objects that have complex structures and can contain data that goes beyond simple strings, numbers,
48
+ * booleans, or error values. For example, hyperlinks and images are represented as rich data.
49
+ */
50
+ readonly RichData: "richData";
51
+ /**
52
+ * Represents the absence of a value.
53
+ */
54
+ readonly Null: "null";
55
+ };
56
+ export type ScalarType = typeof ScalarType[keyof typeof ScalarType];
57
+ /**
58
+ * Extends ScalarType to support `Date`.
59
+ *
60
+ * @see {@link InteropScalar | Javascript Dates}
61
+ */
62
+ export declare const InteropScalarType: {
63
+ /**
64
+ * A date value.
65
+ *
66
+ * @remarks
67
+ * Dates are represented as serial numbers in the underlying data model but
68
+ * can be identified as dates through formatting. This type is used to indicate that a
69
+ * cell's value should be treated as a date, even though it's stored as a number.
70
+ */
71
+ readonly Date: "date";
72
+ /**
73
+ * A numeric value.
74
+ *
75
+ * @remarks
76
+ * Dates are expressed as formatted numbers within cells. They are internally stored as
77
+ * serial numbers and can be formatted to display as dates.
78
+ */
79
+ readonly Number: "number";
80
+ /**
81
+ * A string value.
82
+ */
83
+ readonly String: "string";
84
+ /**
85
+ * A boolean value (`true` or `false`).
86
+ */
87
+ readonly Boolean: "boolean";
88
+ /**
89
+ * A cell that contains an error value.
90
+ *
91
+ * @remarks
92
+ * Error cells represent cells where an error occurred during formula evaluation or data processing.
93
+ */
94
+ readonly Error: "error";
95
+ /**
96
+ * A complex data type represented as {@link IRichData}.
97
+ *
98
+ * @remarks
99
+ * Rich data are objects that have complex structures and can contain data that goes beyond simple strings, numbers,
100
+ * booleans, or error values. For example, hyperlinks and images are represented as rich data.
101
+ */
102
+ readonly RichData: "richData";
103
+ /**
104
+ * Represents the absence of a value.
105
+ */
106
+ readonly Null: "null";
107
+ };
108
+ export type InteropScalarType = typeof InteropScalarType[keyof typeof InteropScalarType];
109
+ //# sourceMappingURL=ScalarType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarType.d.ts","sourceRoot":"","sources":["../../../src/ScalarType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;;OAMG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;;;OAKG;;IAEH;;;;;;OAMG;;IAEH;;OAEG;;CAEK,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAE5B;;;;;;;OAOG;;IApDH;;;;;;OAMG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;;;OAKG;;IAEH;;;;;;OAMG;;IAEH;;OAEG;;CAqBK,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Scalar } from './Scalar';
2
+ /**
3
+ * Wildcard syntax: `*` for any run of characters, `?` for exactly one, `~` to escape.
4
+ */
5
+ export declare const WildCard: {
6
+ /**
7
+ * Indicates if the give item is a wildcard string.
8
+ */
9
+ isWildCard: (obj: Scalar) => boolean;
10
+ /**
11
+ * Compiles Excel wildcard text into a regex.
12
+ *
13
+ * @param anchor Whether the pattern must match the WHOLE string. Excel matches a whole cell, so
14
+ * every lookup and criteria caller anchors; `SEARCH`, which looks for a substring, does not.
15
+ *
16
+ * @remarks
17
+ * `~` escapes the next `*`, `?` or `~`; standing alone it is a literal tilde (`COUNTIF(range,
18
+ * "a~b")` finds the text `a~b`). One left-to-right pass, because chained replaces cannot express
19
+ * this: the previous implementation guarded its `*`/`?` rewrites with `([^~]??)`, a lazy OPTIONAL
20
+ * group that matches empty and so guards nothing, and then unescaped `~([?*])` — which could
21
+ * never fire, the `*` and `?` having already become `.*` and `.`. Every escape was silently
22
+ * ignored, so `"~*"` compiled to `~.*`: a literal tilde followed by anything.
23
+ */
24
+ toRegex: (lookupText: string, flags?: any, anchor?: boolean) => RegExp;
25
+ };
26
+ //# sourceMappingURL=WildCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WildCard.d.ts","sourceRoot":"","sources":["../../../src/WildCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAMvC;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB;;OAEG;sBACe,MAAM,KAAG,OAAO;IAMlC;;;;;;;;;;;;;OAaG;0BACmB,MAAM,UAAU,GAAG,WAAU,OAAO,KAAW,MAAM;CAqB5E,CAAC"}
@@ -0,0 +1,20 @@
1
+ export * from './Scalar';
2
+ export * from './ScalarType';
3
+ export * from './WildCard';
4
+ export * from './Lambda';
5
+ export * from './ErrorPolicy';
6
+ export * from './Repeating';
7
+ export * from './Flatten';
8
+ export * from './Omittable';
9
+ export * from './IRange';
10
+ export * from './IReferenceRange';
11
+ export * from './IRichData';
12
+ export * from './IFunction';
13
+ export * from './IFormulaContext';
14
+ export * from './LocaleProfile';
15
+ export * from './IRuntime';
16
+ export * from './IRangeStats';
17
+ export * from './FormulaError';
18
+ export * from './Observable';
19
+ export * from './FormulaContext';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAE5B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAElC,cAAc,aAAa,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAE7B,cAAc,kBAAkB,CAAC"}