@dicelette/core 1.28.0 → 1.28.2

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.mts CHANGED
@@ -320,6 +320,31 @@ declare function replaceInFormula(element: string, diceResult: Resultat, compare
320
320
  compare: Compare | undefined;
321
321
  }, res: boolean, engine?: Engine | null, pity?: boolean): string;
322
322
 
323
+ /**
324
+ * Replace the stat name by their value using stat
325
+ * and after evaluate any formula using `replaceFormulaInDice`
326
+ * @param {string} originalDice
327
+ * @param {Record<string,number>|undefined} stats
328
+ * @param {number} minThreshold Minimum similarity threshold to consider a stat name match
329
+ * @param {string|undefined} dollarValue
330
+ */
331
+ declare function generateStatsDice(originalDice: string, stats?: Record<string, number>, minThreshold?: number, dollarValue?: string): string;
332
+ /**
333
+ * Replace the {{}} in the dice string and evaluate the interior if any
334
+ * @param dice {string}
335
+ */
336
+ declare function replaceFormulaInDice(dice: string): string;
337
+
338
+ type FormulaHintResult = {
339
+ kind: "resolved";
340
+ value: number;
341
+ } | {
342
+ kind: "error";
343
+ } | {
344
+ kind: "not-formula";
345
+ };
346
+ declare function resolveFormulaHint(formula: string, allAttributes: Record<string, number | string>, similarityThreshold?: number): FormulaHintResult;
347
+
323
348
  /**
324
349
  * Utility functions for string similarity and distance calculations.
325
350
  */
@@ -353,20 +378,6 @@ declare function escapeRegex(string: string): string;
353
378
  * @return {string} the dice with the text in brackets as if, but the dice (not in brackets) is standardized
354
379
  */
355
380
  declare function standardizeDice(dice: string): string;
356
- /**
357
- * Replace the stat name by their value using stat
358
- * and after evaluate any formula using `replaceFormulaInDice`
359
- * @param {string} originalDice
360
- * @param {Record<string,number>|undefined} stats
361
- * @param {number} minThreshold Minimum similarity threshold to consider a stat name match
362
- * @param {string|undefined} dollarValue
363
- */
364
- declare function generateStatsDice(originalDice: string, stats?: Record<string, number>, minThreshold?: number, dollarValue?: string): string;
365
- /**
366
- * Replace the {{}} in the dice string and evaluate the interior if any
367
- * @param dice {string}
368
- */
369
- declare function replaceFormulaInDice(dice: string): string;
370
381
  /**
371
382
  * Verify if a value is a number, even if it's a "number" string
372
383
  * @param value {unknown}
@@ -466,4 +477,4 @@ declare function testStatCombinaison(template: StatisticalTemplate, engine?: Eng
466
477
  */
467
478
  declare function generateRandomStat(total?: number | undefined, max?: number, min?: number, engine?: Engine | null): number;
468
479
 
469
- export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, MIN_THRESHOLD_MATCH, MaxGreater, type Modifier, NORMALIZE_SINGLE_DICE, NoStatisticsError, OPTIONAL_COMMENT, REMOVER_PATTERN, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, SortOrder, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculateSimilarity, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, findBestRecord, findBestStatMatch, generateRandomStat, generateStatsDice, getCachedRegex, getEngine, getEngineId, includeDiceType, isNumber, levenshteinDistance, randomInt, replaceExpByRandom, replaceFormulaInDice, replaceInFormula, replaceUnknown, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyStatMatcherPattern, verifyTemplateValue };
480
+ export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, type FormulaHintResult, MIN_THRESHOLD_MATCH, MaxGreater, type Modifier, NORMALIZE_SINGLE_DICE, NoStatisticsError, OPTIONAL_COMMENT, REMOVER_PATTERN, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, SortOrder, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculateSimilarity, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, findBestRecord, findBestStatMatch, generateRandomStat, generateStatsDice, getCachedRegex, getEngine, getEngineId, includeDiceType, isNumber, levenshteinDistance, randomInt, replaceExpByRandom, replaceFormulaInDice, replaceInFormula, replaceUnknown, resolveFormulaHint, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyStatMatcherPattern, verifyTemplateValue };
package/dist/index.d.ts CHANGED
@@ -320,6 +320,31 @@ declare function replaceInFormula(element: string, diceResult: Resultat, compare
320
320
  compare: Compare | undefined;
321
321
  }, res: boolean, engine?: Engine | null, pity?: boolean): string;
322
322
 
323
+ /**
324
+ * Replace the stat name by their value using stat
325
+ * and after evaluate any formula using `replaceFormulaInDice`
326
+ * @param {string} originalDice
327
+ * @param {Record<string,number>|undefined} stats
328
+ * @param {number} minThreshold Minimum similarity threshold to consider a stat name match
329
+ * @param {string|undefined} dollarValue
330
+ */
331
+ declare function generateStatsDice(originalDice: string, stats?: Record<string, number>, minThreshold?: number, dollarValue?: string): string;
332
+ /**
333
+ * Replace the {{}} in the dice string and evaluate the interior if any
334
+ * @param dice {string}
335
+ */
336
+ declare function replaceFormulaInDice(dice: string): string;
337
+
338
+ type FormulaHintResult = {
339
+ kind: "resolved";
340
+ value: number;
341
+ } | {
342
+ kind: "error";
343
+ } | {
344
+ kind: "not-formula";
345
+ };
346
+ declare function resolveFormulaHint(formula: string, allAttributes: Record<string, number | string>, similarityThreshold?: number): FormulaHintResult;
347
+
323
348
  /**
324
349
  * Utility functions for string similarity and distance calculations.
325
350
  */
@@ -353,20 +378,6 @@ declare function escapeRegex(string: string): string;
353
378
  * @return {string} the dice with the text in brackets as if, but the dice (not in brackets) is standardized
354
379
  */
355
380
  declare function standardizeDice(dice: string): string;
356
- /**
357
- * Replace the stat name by their value using stat
358
- * and after evaluate any formula using `replaceFormulaInDice`
359
- * @param {string} originalDice
360
- * @param {Record<string,number>|undefined} stats
361
- * @param {number} minThreshold Minimum similarity threshold to consider a stat name match
362
- * @param {string|undefined} dollarValue
363
- */
364
- declare function generateStatsDice(originalDice: string, stats?: Record<string, number>, minThreshold?: number, dollarValue?: string): string;
365
- /**
366
- * Replace the {{}} in the dice string and evaluate the interior if any
367
- * @param dice {string}
368
- */
369
- declare function replaceFormulaInDice(dice: string): string;
370
381
  /**
371
382
  * Verify if a value is a number, even if it's a "number" string
372
383
  * @param value {unknown}
@@ -466,4 +477,4 @@ declare function testStatCombinaison(template: StatisticalTemplate, engine?: Eng
466
477
  */
467
478
  declare function generateRandomStat(total?: number | undefined, max?: number, min?: number, engine?: Engine | null): number;
468
479
 
469
- export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, MIN_THRESHOLD_MATCH, MaxGreater, type Modifier, NORMALIZE_SINGLE_DICE, NoStatisticsError, OPTIONAL_COMMENT, REMOVER_PATTERN, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, SortOrder, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculateSimilarity, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, findBestRecord, findBestStatMatch, generateRandomStat, generateStatsDice, getCachedRegex, getEngine, getEngineId, includeDiceType, isNumber, levenshteinDistance, randomInt, replaceExpByRandom, replaceFormulaInDice, replaceInFormula, replaceUnknown, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyStatMatcherPattern, verifyTemplateValue };
480
+ export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, type FormulaHintResult, MIN_THRESHOLD_MATCH, MaxGreater, type Modifier, NORMALIZE_SINGLE_DICE, NoStatisticsError, OPTIONAL_COMMENT, REMOVER_PATTERN, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, SortOrder, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculateSimilarity, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, findBestRecord, findBestStatMatch, generateRandomStat, generateStatsDice, getCachedRegex, getEngine, getEngineId, includeDiceType, isNumber, levenshteinDistance, randomInt, replaceExpByRandom, replaceFormulaInDice, replaceInFormula, replaceUnknown, resolveFormulaHint, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyStatMatcherPattern, verifyTemplateValue };