@devmm/puredocs-excel-formula 1.1.2 → 1.1.3

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/index.d.cts CHANGED
@@ -295,6 +295,29 @@ declare namespace FormulaHelper {
295
295
  function compileCriteria(criteria: string): CompiledCriteria;
296
296
  /** Matches a criteria string (e.g. ">5", "=hello", "*partial*") against a value. */
297
297
  function matchesCriteria(value: FormulaValue, criteria: string): boolean;
298
+ /**
299
+ * True when a string is an Excel *pattern* rather than a literal — it contains
300
+ * a wildcard, or a `~` that may be escaping one.
301
+ *
302
+ * The tilde counts because `~*` is how Excel spells a literal asterisk: such a
303
+ * string has no wildcard left after unescaping, but it still has to go through
304
+ * {@link wildcardToRegex} for the escape to be honoured rather than matched.
305
+ *
306
+ * This is the one place that decides "is this a pattern?", shared by the
307
+ * criteria family (`COUNTIF`, `SUMIF`, …) and the lookup family (`MATCH`,
308
+ * `VLOOKUP`, `HLOOKUP`) so the two can never disagree about a given criterion.
309
+ */
310
+ function hasWildcardSyntax(pattern: string): boolean;
311
+ /**
312
+ * Compiles an Excel wildcard pattern into an anchored, case-insensitive RegExp:
313
+ * `*` is any run of characters, `?` is any one character, and `~` escapes the
314
+ * next character when that character is `*`, `?` or `~` — a `~` before anything
315
+ * else is a literal tilde, as in Excel.
316
+ *
317
+ * Built character by character rather than by chained `replace` calls, because
318
+ * a replace pass cannot tell an escaped `~*` from a wildcard.
319
+ */
320
+ function wildcardToRegex(pattern: string): RegExp;
298
321
  }
299
322
 
300
323
  /**
@@ -332,7 +355,14 @@ declare class RangeCache {
332
355
  get(sheet: string, r0: number, c0: number, r1: number, c1: number): FormulaValue | undefined;
333
356
  /** Memoises a rectangle's value. `cells` is its area, for the budget. */
334
357
  set(sheet: string, r0: number, c0: number, r1: number, c1: number, value: FormulaValue, cells: number): void;
335
- /** Drops every cached rectangle containing the given cell. */
358
+ /**
359
+ * Drops every cached rectangle containing the given cell.
360
+ *
361
+ * The bucket sets are iterated in place. Removing an element of a `Set` while
362
+ * iterating it is defined behaviour — the iterator simply does not revisit it —
363
+ * and copying instead cost one array per write, which at one write per formula
364
+ * was a real share of a recalculation.
365
+ */
336
366
  invalidateCell(sheet: string, row: number, col: number): void;
337
367
  clear(): void;
338
368
  }
package/dist/index.d.ts CHANGED
@@ -295,6 +295,29 @@ declare namespace FormulaHelper {
295
295
  function compileCriteria(criteria: string): CompiledCriteria;
296
296
  /** Matches a criteria string (e.g. ">5", "=hello", "*partial*") against a value. */
297
297
  function matchesCriteria(value: FormulaValue, criteria: string): boolean;
298
+ /**
299
+ * True when a string is an Excel *pattern* rather than a literal — it contains
300
+ * a wildcard, or a `~` that may be escaping one.
301
+ *
302
+ * The tilde counts because `~*` is how Excel spells a literal asterisk: such a
303
+ * string has no wildcard left after unescaping, but it still has to go through
304
+ * {@link wildcardToRegex} for the escape to be honoured rather than matched.
305
+ *
306
+ * This is the one place that decides "is this a pattern?", shared by the
307
+ * criteria family (`COUNTIF`, `SUMIF`, …) and the lookup family (`MATCH`,
308
+ * `VLOOKUP`, `HLOOKUP`) so the two can never disagree about a given criterion.
309
+ */
310
+ function hasWildcardSyntax(pattern: string): boolean;
311
+ /**
312
+ * Compiles an Excel wildcard pattern into an anchored, case-insensitive RegExp:
313
+ * `*` is any run of characters, `?` is any one character, and `~` escapes the
314
+ * next character when that character is `*`, `?` or `~` — a `~` before anything
315
+ * else is a literal tilde, as in Excel.
316
+ *
317
+ * Built character by character rather than by chained `replace` calls, because
318
+ * a replace pass cannot tell an escaped `~*` from a wildcard.
319
+ */
320
+ function wildcardToRegex(pattern: string): RegExp;
298
321
  }
299
322
 
300
323
  /**
@@ -332,7 +355,14 @@ declare class RangeCache {
332
355
  get(sheet: string, r0: number, c0: number, r1: number, c1: number): FormulaValue | undefined;
333
356
  /** Memoises a rectangle's value. `cells` is its area, for the budget. */
334
357
  set(sheet: string, r0: number, c0: number, r1: number, c1: number, value: FormulaValue, cells: number): void;
335
- /** Drops every cached rectangle containing the given cell. */
358
+ /**
359
+ * Drops every cached rectangle containing the given cell.
360
+ *
361
+ * The bucket sets are iterated in place. Removing an element of a `Set` while
362
+ * iterating it is defined behaviour — the iterator simply does not revisit it —
363
+ * and copying instead cost one array per write, which at one write per formula
364
+ * was a real share of a recalculation.
365
+ */
336
366
  invalidateCell(sheet: string, row: number, col: number): void;
337
367
  clear(): void;
338
368
  }