quantible 0.1.6-alpha → 0.1.8-alpha
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 +107 -0
- package/dist/{types/index.d.ts → index.d.ts} +52 -4
- package/package.json +4 -6
- package/dist/types/config/default.d.ts +0 -40
- package/dist/types/config/default.d.ts.map +0 -1
- package/dist/types/converters/convertCurrencyToSpokenWord.d.ts +0 -8
- package/dist/types/converters/convertCurrencyToSpokenWord.d.ts.map +0 -1
- package/dist/types/converters/convertNumberToSpokenWord.d.ts +0 -8
- package/dist/types/converters/convertNumberToSpokenWord.d.ts.map +0 -1
- package/dist/types/converters/convertNumericUnitToSpokenWord.d.ts +0 -8
- package/dist/types/converters/convertNumericUnitToSpokenWord.d.ts.map +0 -1
- package/dist/types/converters/convertOperatorToSpokenWord.d.ts +0 -8
- package/dist/types/converters/convertOperatorToSpokenWord.d.ts.map +0 -1
- package/dist/types/converters/convertScientificExpressionToSpokenWord.d.ts +0 -8
- package/dist/types/converters/convertScientificExpressionToSpokenWord.d.ts.map +0 -1
- package/dist/types/converters/convertUnitOnlyToSpokenWord.d.ts +0 -8
- package/dist/types/converters/convertUnitOnlyToSpokenWord.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/interfaces/configurations/default.d.ts +0 -23
- package/dist/types/interfaces/configurations/default.d.ts.map +0 -1
- package/dist/types/interfaces/definitions.d.ts +0 -101
- package/dist/types/interfaces/definitions.d.ts.map +0 -1
- package/dist/types/utils/extraction/patternExtractor.d.ts +0 -22
- package/dist/types/utils/extraction/patternExtractor.d.ts.map +0 -1
- package/dist/types/utils/extraction/regexPatterns.d.ts +0 -3
- package/dist/types/utils/extraction/regexPatterns.d.ts.map +0 -1
- package/dist/types/utils/parseSuperscript.d.ts +0 -7
- package/dist/types/utils/parseSuperscript.d.ts.map +0 -1
- package/dist/types/utils/stringBuilding/exponent.d.ts +0 -3
- package/dist/types/utils/stringBuilding/exponent.d.ts.map +0 -1
- package/dist/types/utils/stringBuilding/negative.d.ts +0 -2
- package/dist/types/utils/stringBuilding/negative.d.ts.map +0 -1
- package/dist/types/utils/stringBuilding/perDigit.d.ts +0 -8
- package/dist/types/utils/stringBuilding/perDigit.d.ts.map +0 -1
- package/dist/types/utils/stringBuilding/positiveInteger.d.ts +0 -7
- package/dist/types/utils/stringBuilding/positiveInteger.d.ts.map +0 -1
- package/dist/types/utils/stringBuilding/twoDigits.d.ts +0 -7
- package/dist/types/utils/stringBuilding/twoDigits.d.ts.map +0 -1
- package/dist/types/utils/stringBuilding/zeroTo999.d.ts +0 -7
- package/dist/types/utils/stringBuilding/zeroTo999.d.ts.map +0 -1
- package/dist/types/utils/validateExtractionResultObject.d.ts +0 -13
- package/dist/types/utils/validateExtractionResultObject.d.ts.map +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @interface ExtractionResult
|
|
3
|
+
* @description Represents all possible extraction results
|
|
4
|
+
* and contains all properties that can be extracted from a given input string.
|
|
5
|
+
*/
|
|
6
|
+
interface ExtractionResult {
|
|
7
|
+
input: string;
|
|
8
|
+
matchType: string;
|
|
9
|
+
index: number;
|
|
10
|
+
integer?: string;
|
|
11
|
+
decimal?: string;
|
|
12
|
+
negativeInt?: boolean;
|
|
13
|
+
currency?: string;
|
|
14
|
+
exponent?: string;
|
|
15
|
+
unit?: string;
|
|
16
|
+
unitExponent?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns the first match of a number, currency, unit, or exponent in the given string.
|
|
21
|
+
* The returned object contains the extracted groups and additional information such as
|
|
22
|
+
* the type of match and the index of the match in the string.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} input - The string to search for matches
|
|
25
|
+
* @returns {patternExtraction | null} - The extracted groups and additional information, or null if no match is found
|
|
26
|
+
*/
|
|
27
|
+
declare function extractFirstMatch(input: string): ExtractionResult | null;
|
|
28
|
+
/**
|
|
29
|
+
* Extracts all matches of a number, currency, unit, or exponent in the given string
|
|
30
|
+
* and returns an array of the extracted groups and additional information such as
|
|
31
|
+
* the type of match and the index of the match in the string.
|
|
32
|
+
*
|
|
33
|
+
* If the input string contains no matches, an empty array is returned.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} input - The string to search for matches
|
|
36
|
+
* @returns {patternExtraction[]} - The extracted groups and additional information, or an empty array if no match is found
|
|
37
|
+
*/
|
|
38
|
+
declare function extractAllMatches(input: string): ExtractionResult[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Validates an ExtractionResult object.
|
|
42
|
+
*
|
|
43
|
+
* Checks that the object is present, contains the required properties, and that
|
|
44
|
+
* the values of those properties are of the correct type.
|
|
45
|
+
*
|
|
46
|
+
* If the object is invalid, throws an Error with a description of the problem.
|
|
47
|
+
*
|
|
48
|
+
* @param {ExtractionResult} extractionResult - The object to validate.
|
|
49
|
+
*/
|
|
50
|
+
declare function validateExtractionResult(extractionResult: ExtractionResult): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @namespace extractQuantities
|
|
54
|
+
* @description Contains functions for extracting numeric data from a string.
|
|
55
|
+
*/
|
|
56
|
+
declare const extractQuantities: {
|
|
57
|
+
/**
|
|
58
|
+
* Extracts the first match (number || currency || unit || operator || scientific expression) from the input string.
|
|
59
|
+
* @param {string} input - The string to extract from.
|
|
60
|
+
* @returns {ExtractionResult | null} The extracted data or null if no match is found.
|
|
61
|
+
*/
|
|
62
|
+
firstMatch: typeof extractFirstMatch;
|
|
63
|
+
/**
|
|
64
|
+
* Extracts all matches (number || currency || unit || operator || scientific expression) from the input string.
|
|
65
|
+
* @param {string} input - The string to extract from.
|
|
66
|
+
* @returns {ExtractionResult[]} The extracted data.
|
|
67
|
+
*/
|
|
68
|
+
allMatches: typeof extractAllMatches;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* @namespace convertQuantities
|
|
72
|
+
* @description Contains functions for converting (number || currency || unit || operator || scientific expression) data from a string or object to spoken word.
|
|
73
|
+
*/
|
|
74
|
+
declare const convertQuantities: {
|
|
75
|
+
/**
|
|
76
|
+
* Translates an ExtractionResult object (number || currency || unit || operator || scientific expression) into its spoken word equivalent.
|
|
77
|
+
*
|
|
78
|
+
* @param {ExtractionResult} extractionResult - The ExtractionResult object to translate.
|
|
79
|
+
* @returns {string} The spoken word equivalent of the ExtractionResult.
|
|
80
|
+
*/
|
|
81
|
+
/**
|
|
82
|
+
* Translates an ExtractionResult object (number || currency || unit || operator || scientific expression) into its spoken word equivalent.
|
|
83
|
+
*
|
|
84
|
+
* @param {ExtractionResult} extractionResult - The ExtractionResult object to translate.
|
|
85
|
+
* @returns {string} The spoken word equivalent of the ExtractionResult.
|
|
86
|
+
*/
|
|
87
|
+
translateMatch: (extractionResult: ExtractionResult) => string;
|
|
88
|
+
/**
|
|
89
|
+
* Extracts the first match (number || currency || unit || operator || scientific expression) from the input string
|
|
90
|
+
* and translates it to its spoken word equivalent.
|
|
91
|
+
*
|
|
92
|
+
* @param {string} input - The string to extract and translate from.
|
|
93
|
+
* @returns {string} The input string with the first match replaced by its spoken word equivalent,
|
|
94
|
+
* or an empty string if no match is found.
|
|
95
|
+
*/
|
|
96
|
+
autoReplaceFirstMatch: (input: string) => string;
|
|
97
|
+
/**
|
|
98
|
+
* Extracts all matches (number || currency || unit || operator || scientific expression) from the input string
|
|
99
|
+
* and translates them to their spoken word equivalents.
|
|
100
|
+
*
|
|
101
|
+
* @param {string} input - The string to extract and translate from.
|
|
102
|
+
* @returns {string} The input string with all matches replaced by their spoken word equivalents. Returns the original string if no matches are found.
|
|
103
|
+
*/
|
|
104
|
+
autoReplaceAllMatches: (input: string) => string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export { convertQuantities, extractQuantities, validateExtractionResult };
|
|
@@ -1,6 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @interface ExtractionResult
|
|
3
|
+
* @description Represents all possible extraction results
|
|
4
|
+
* and contains all properties that can be extracted from a given input string.
|
|
5
|
+
*/
|
|
6
|
+
interface ExtractionResult {
|
|
7
|
+
input: string;
|
|
8
|
+
matchType: string;
|
|
9
|
+
index: number;
|
|
10
|
+
integer?: string;
|
|
11
|
+
decimal?: string;
|
|
12
|
+
negativeInt?: boolean;
|
|
13
|
+
currency?: string;
|
|
14
|
+
exponent?: string;
|
|
15
|
+
unit?: string;
|
|
16
|
+
unitExponent?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns the first match of a number, currency, unit, or exponent in the given string.
|
|
21
|
+
* The returned object contains the extracted groups and additional information such as
|
|
22
|
+
* the type of match and the index of the match in the string.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} input - The string to search for matches
|
|
25
|
+
* @returns {patternExtraction | null} - The extracted groups and additional information, or null if no match is found
|
|
26
|
+
*/
|
|
27
|
+
declare function extractFirstMatch(input: string): ExtractionResult | null;
|
|
28
|
+
/**
|
|
29
|
+
* Extracts all matches of a number, currency, unit, or exponent in the given string
|
|
30
|
+
* and returns an array of the extracted groups and additional information such as
|
|
31
|
+
* the type of match and the index of the match in the string.
|
|
32
|
+
*
|
|
33
|
+
* If the input string contains no matches, an empty array is returned.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} input - The string to search for matches
|
|
36
|
+
* @returns {patternExtraction[]} - The extracted groups and additional information, or an empty array if no match is found
|
|
37
|
+
*/
|
|
38
|
+
declare function extractAllMatches(input: string): ExtractionResult[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Validates an ExtractionResult object.
|
|
42
|
+
*
|
|
43
|
+
* Checks that the object is present, contains the required properties, and that
|
|
44
|
+
* the values of those properties are of the correct type.
|
|
45
|
+
*
|
|
46
|
+
* If the object is invalid, throws an Error with a description of the problem.
|
|
47
|
+
*
|
|
48
|
+
* @param {ExtractionResult} extractionResult - The object to validate.
|
|
49
|
+
*/
|
|
50
|
+
declare function validateExtractionResult(extractionResult: ExtractionResult): void;
|
|
51
|
+
|
|
4
52
|
/**
|
|
5
53
|
* @namespace extractQuantities
|
|
6
54
|
* @description Contains functions for extracting numeric data from a string.
|
|
@@ -55,5 +103,5 @@ declare const convertQuantities: {
|
|
|
55
103
|
*/
|
|
56
104
|
autoReplaceAllMatches: (input: string) => string;
|
|
57
105
|
};
|
|
106
|
+
|
|
58
107
|
export { convertQuantities, extractQuantities, validateExtractionResult };
|
|
59
|
-
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quantible",
|
|
3
3
|
"description": "A versatile library for extracting and converting numerical values, units, currency, and mathematical expressions into their spoken word equivalents.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.8-alpha",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
8
8
|
"browser": "dist/index.iife.js",
|
|
9
|
-
"types": "dist/
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"types": "./dist/
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
13
|
"browser": "./dist/index.iife.js",
|
|
14
14
|
"import": "./dist/index.esm.js",
|
|
15
15
|
"require": "./dist/index.cjs.js",
|
|
@@ -22,9 +22,7 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"scripts": {
|
|
24
24
|
"prebuild": "rm -rf dist",
|
|
25
|
-
"build
|
|
26
|
-
"build:js": "npx tsup",
|
|
27
|
-
"build": "npm run prebuild && npm run build:js && npm run build:dts",
|
|
25
|
+
"build": "rm -rf dist && tsup",
|
|
28
26
|
"test": "jest _tests_",
|
|
29
27
|
"compile": "npm run build && node dist/index.js",
|
|
30
28
|
"lint": "eslint . --ext .ts",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Currency, Unit } from "../interfaces/configurations/default.js";
|
|
2
|
-
export declare const units: {
|
|
3
|
-
[key: string]: Unit;
|
|
4
|
-
};
|
|
5
|
-
export declare const numbers: {
|
|
6
|
-
ones: string[];
|
|
7
|
-
teens: string[];
|
|
8
|
-
tens: string[];
|
|
9
|
-
scales: string[];
|
|
10
|
-
ordinals: {
|
|
11
|
-
one: string;
|
|
12
|
-
two: string;
|
|
13
|
-
three: string;
|
|
14
|
-
five: string;
|
|
15
|
-
eight: string;
|
|
16
|
-
nine: string;
|
|
17
|
-
twelve: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const currencySymbols: {
|
|
21
|
-
[key: string]: Currency;
|
|
22
|
-
};
|
|
23
|
-
export declare const currencyCodes: {
|
|
24
|
-
[key: string]: Currency;
|
|
25
|
-
};
|
|
26
|
-
export declare const currencies: {
|
|
27
|
-
[x: string]: Currency;
|
|
28
|
-
};
|
|
29
|
-
export declare const math: {
|
|
30
|
-
"+": string;
|
|
31
|
-
"-": string;
|
|
32
|
-
"*": string;
|
|
33
|
-
"\u00D7": string;
|
|
34
|
-
"\u00B7": string;
|
|
35
|
-
"/": string;
|
|
36
|
-
"\u00F7": string;
|
|
37
|
-
":": string;
|
|
38
|
-
"^": string;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/config/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAEzE,eAAO,MAAM,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CA8TxC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;CAcnB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CA0BtD,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAyCpD,CAAC;AAEF,eAAO,MAAM,UAAU;;CAGtB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;CAUhB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { baseCurrency } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a currency object into its spoken word representation.
|
|
4
|
-
* @param {baseCurrency} amount - The currency object to convert.
|
|
5
|
-
* @returns {string} The spoken word representation of the currency.
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertCurrencyToSpokenWord(amount: baseCurrency): string;
|
|
8
|
-
//# sourceMappingURL=convertCurrencyToSpokenWord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertCurrencyToSpokenWord.d.ts","sourceRoot":"","sources":["../../../src/converters/convertCurrencyToSpokenWord.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAiBxE"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { baseNumber } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a number object into its spoken word representation.
|
|
4
|
-
* @param {baseNumber} num - The number object to convert.
|
|
5
|
-
* @returns {string} The spoken word representation of the number.
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertNumberToSpokenWord(num: baseNumber): string;
|
|
8
|
-
//# sourceMappingURL=convertNumberToSpokenWord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertNumberToSpokenWord.d.ts","sourceRoot":"","sources":["../../../src/converters/convertNumberToSpokenWord.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAoBjE"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { baseNumberUnit } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a numeric unit object into its spoken word representation.
|
|
4
|
-
* @param {baseNumberUnit} numericUnit - The numeric unit object to convert.
|
|
5
|
-
* @returns {string} The spoken word representation of the numeric unit.
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertNumericUnitToSpokenWord(numericUnit: baseNumberUnit): string;
|
|
8
|
-
//# sourceMappingURL=convertNumericUnitToSpokenWord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertNumericUnitToSpokenWord.d.ts","sourceRoot":"","sources":["../../../src/converters/convertNumericUnitToSpokenWord.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9D;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,cAAc,GAAG,MAAM,CA+ClF"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { baseOperator } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Converts an operator object into its spoken word representation.
|
|
4
|
-
* @param {baseOperator} operatorObject - The operator object to convert.
|
|
5
|
-
* @returns {string} The spoken word representation of the operator.
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertOperatorToSpokenWord(operatorObject: baseOperator): string;
|
|
8
|
-
//# sourceMappingURL=convertOperatorToSpokenWord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertOperatorToSpokenWord.d.ts","sourceRoot":"","sources":["../../../src/converters/convertOperatorToSpokenWord.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,CAMhF"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { baseScientific } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a scientific expression object into its spoken word representation.
|
|
4
|
-
* @param {baseScientific} expression - The scientific expression object to convert.
|
|
5
|
-
* @returns {string} The spoken word representation of the scientific expression.
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertScientificExpressionToSpokenWord(expression: baseScientific): string;
|
|
8
|
-
//# sourceMappingURL=convertScientificExpressionToSpokenWord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertScientificExpressionToSpokenWord.d.ts","sourceRoot":"","sources":["../../../src/converters/convertScientificExpressionToSpokenWord.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,uCAAuC,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,CA8B1F"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { baseUnitOnly } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a unit-only object into its spoken word representation.
|
|
4
|
-
* @param {baseUnitOnly} unitOnlyObject - The unit-only object to convert.
|
|
5
|
-
* @returns {string} The spoken word representation of the unit.
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertUnitOnlyToSpokenWord(unitOnlyObject: baseUnitOnly): string;
|
|
8
|
-
//# sourceMappingURL=convertUnitOnlyToSpokenWord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertUnitOnlyToSpokenWord.d.ts","sourceRoot":"","sources":["../../../src/converters/convertUnitOnlyToSpokenWord.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,CAkBhF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAQ9F,OAAO,EAOL,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAErF;;;GAGG;AACH,QAAA,MAAM,iBAAiB;IACrB;;;;OAIG;;IAEH;;;;OAIG;;CAEJ,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,iBAAiB;IACrB;;;;;OAKG;IACH;;;;;OAKG;uCACgC,gBAAgB,KAAG,MAAM;IAiC5D;;;;;;;OAOG;mCAC4B,MAAM,KAAG,MAAM;IAM9C;;;;;;OAMG;mCAC4B,MAAM,KAAG,MAAM;CAmB/C,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAG,iBAAiB,EAAE,wBAAwB,EAAE,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for currency fraction (e.g., cents).
|
|
3
|
-
*/
|
|
4
|
-
export interface CurrencyFractionConfig {
|
|
5
|
-
singular: string;
|
|
6
|
-
plural: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Configuration for currency (e.g., USD).
|
|
10
|
-
*/
|
|
11
|
-
export interface Currency {
|
|
12
|
-
singular: string;
|
|
13
|
-
plural: string;
|
|
14
|
-
fraction: CurrencyFractionConfig | null;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Configuration for a unit (e.g., meter).
|
|
18
|
-
*/
|
|
19
|
-
export interface Unit {
|
|
20
|
-
singular: string;
|
|
21
|
-
plural: string;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/configurations/default.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the base structure for all extraction results,
|
|
3
|
-
* containing the input string, match type, index, and length of the extracted value.
|
|
4
|
-
*/
|
|
5
|
-
interface baseExtraction {
|
|
6
|
-
input: string;
|
|
7
|
-
matchType: string;
|
|
8
|
-
index: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @interface numericBaseExtraction
|
|
12
|
-
* @extends {baseExtraction}
|
|
13
|
-
* @description Represents the base structure for numeric extraction results,
|
|
14
|
-
* extending the baseExtraction with properties for integer, decimal, and negative integer indication.
|
|
15
|
-
*/
|
|
16
|
-
interface numericBaseExtraction extends baseExtraction {
|
|
17
|
-
integer: string;
|
|
18
|
-
decimal?: string;
|
|
19
|
-
negativeInt: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @interface baseCurrency
|
|
23
|
-
* @extends {numericBaseExtraction}
|
|
24
|
-
* @description Represents the structure for currency extraction results,
|
|
25
|
-
* extending the numericBaseExtraction with properties for match type (symbol or code) and currency symbol or code.
|
|
26
|
-
*/
|
|
27
|
-
export interface baseCurrency extends numericBaseExtraction {
|
|
28
|
-
matchType: "symbolCurrency" | "codeCurrency";
|
|
29
|
-
currency: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @interface baseScientific
|
|
33
|
-
* @extends {numericBaseExtraction}
|
|
34
|
-
* @description Represents the structure for scientific notation extraction results,
|
|
35
|
-
* extending the numericBaseExtraction with properties for match type (scientific) and a mandatory exponent value.
|
|
36
|
-
*/
|
|
37
|
-
export interface baseScientific extends numericBaseExtraction {
|
|
38
|
-
matchType: "scientific";
|
|
39
|
-
exponent: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @interface baseNumberUnit
|
|
43
|
-
* @extends {numericBaseExtraction}
|
|
44
|
-
* @description Represents the structure for quantitative unit extraction results,
|
|
45
|
-
* extending the numericBaseExtraction with properties for match type (unit), unit name, optional exponent, and optional unit exponent.
|
|
46
|
-
*/
|
|
47
|
-
export interface baseNumberUnit extends numericBaseExtraction {
|
|
48
|
-
matchType: "unit";
|
|
49
|
-
unit: string;
|
|
50
|
-
exponent?: string;
|
|
51
|
-
unitExponent?: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @interface baseUnitOnly
|
|
55
|
-
* @extends {baseExtraction}
|
|
56
|
-
* @description Represents the structure for unit-only extraction results,
|
|
57
|
-
* extending the baseExtraction with properties for match type (unitOnly), unit name, and optional unit exponent.
|
|
58
|
-
*/
|
|
59
|
-
export interface baseUnitOnly extends baseExtraction {
|
|
60
|
-
matchType: "unitOnly";
|
|
61
|
-
unit: string;
|
|
62
|
-
unitExponent?: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @interface baseOperator
|
|
66
|
-
* @extends {baseExtraction}
|
|
67
|
-
* @description Represents the structure for mathematical operator extraction results,
|
|
68
|
-
* extending the baseExtraction with a property for match type (operator).
|
|
69
|
-
*/
|
|
70
|
-
export interface baseOperator extends baseExtraction {
|
|
71
|
-
matchType: "operator";
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @interface baseNumber
|
|
75
|
-
* @extends {numericBaseExtraction}
|
|
76
|
-
* @description Represents the structure for number extraction results,
|
|
77
|
-
* extending the numericBaseExtraction with properties for match type (number) and an optional exponent.
|
|
78
|
-
*/
|
|
79
|
-
export interface baseNumber extends numericBaseExtraction {
|
|
80
|
-
matchType: "number";
|
|
81
|
-
exponent?: string;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @interface ExtractionResult
|
|
85
|
-
* @description Represents all possible extraction results
|
|
86
|
-
* and contains all properties that can be extracted from a given input string.
|
|
87
|
-
*/
|
|
88
|
-
export interface ExtractionResult {
|
|
89
|
-
input: string;
|
|
90
|
-
matchType: string;
|
|
91
|
-
index: number;
|
|
92
|
-
integer?: string;
|
|
93
|
-
decimal?: string;
|
|
94
|
-
negativeInt?: boolean;
|
|
95
|
-
currency?: string;
|
|
96
|
-
exponent?: string;
|
|
97
|
-
unit?: string;
|
|
98
|
-
unitExponent?: string;
|
|
99
|
-
}
|
|
100
|
-
export {};
|
|
101
|
-
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/interfaces/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,UAAU,qBAAsB,SAAQ,cAAc;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,qBAAqB;IACzD,SAAS,EAAE,gBAAgB,GAAG,cAAc,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,qBAAqB;IAC3D,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,qBAAqB;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,SAAS,EAAE,UAAU,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,qBAAqB;IACvD,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ExtractionResult } from "../../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Returns the first match of a number, currency, unit, or exponent in the given string.
|
|
4
|
-
* The returned object contains the extracted groups and additional information such as
|
|
5
|
-
* the type of match and the index of the match in the string.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} input - The string to search for matches
|
|
8
|
-
* @returns {patternExtraction | null} - The extracted groups and additional information, or null if no match is found
|
|
9
|
-
*/
|
|
10
|
-
export declare function extractFirstMatch(input: string): ExtractionResult | null;
|
|
11
|
-
/**
|
|
12
|
-
* Extracts all matches of a number, currency, unit, or exponent in the given string
|
|
13
|
-
* and returns an array of the extracted groups and additional information such as
|
|
14
|
-
* the type of match and the index of the match in the string.
|
|
15
|
-
*
|
|
16
|
-
* If the input string contains no matches, an empty array is returned.
|
|
17
|
-
*
|
|
18
|
-
* @param {string} input - The string to search for matches
|
|
19
|
-
* @returns {patternExtraction[]} - The extracted groups and additional information, or an empty array if no match is found
|
|
20
|
-
*/
|
|
21
|
-
export declare function extractAllMatches(input: string): ExtractionResult[];
|
|
22
|
-
//# sourceMappingURL=patternExtractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patternExtractor.d.ts","sourceRoot":"","sources":["../../../../src/utils/extraction/patternExtractor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;;;;GAOG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CA+DxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAsBnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regexPatterns.d.ts","sourceRoot":"","sources":["../../../../src/utils/extraction/regexPatterns.ts"],"names":[],"mappings":"AA0BA,QAAA,MAAM,YAAY,QAkDjB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a string of superscript digits to regular integer string.
|
|
3
|
-
* @param {string} superscriptString - String containing superscript digits.
|
|
4
|
-
* @returns {string} - String of regular digits.
|
|
5
|
-
*/
|
|
6
|
-
export declare function toRegularInteger(superscriptString: string): string;
|
|
7
|
-
//# sourceMappingURL=parseSuperscript.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseSuperscript.d.ts","sourceRoot":"","sources":["../../../src/utils/parseSuperscript.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAwBlE"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** * Converts an exponent integer to its spoken word representation, * optionally using "squared" and "cubed" for exponents 2 and 3. * @param exponent The exponent value as an integer. * @param onlyUsePowerOf A boolean flag. If false, uses "squared" for 2 and "cubed" for 3. * If true, uses "to the power of two", "to the power of three", etc. * @returns The spoken word representation of the exponent. */
|
|
2
|
-
export declare function exponentSpokenWord(exponent: string, onlyUsePowerOf?: boolean): string;
|
|
3
|
-
//# sourceMappingURL=exponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exponent.d.ts","sourceRoot":"","sources":["../../../../src/utils/stringBuilding/exponent.ts"],"names":[],"mappings":"AAGA,sZAAsZ;AAEtZ,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,GAAE,OAAe,GAAG,MAAM,CAa5F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negative.d.ts","sourceRoot":"","sources":["../../../../src/utils/stringBuilding/negative.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,MAAM,OAAO,KAAG,MAExC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts each digit in a number to words, and returns them as a joined string.
|
|
3
|
-
* @param num The number to convert, as a string.
|
|
4
|
-
* @returns A string of space-separated words, where each word is a digit in the original number.
|
|
5
|
-
* @example convertPerDigit("123") => "one two three"
|
|
6
|
-
*/
|
|
7
|
-
export declare function perDigit(num: string): string;
|
|
8
|
-
//# sourceMappingURL=perDigit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"perDigit.d.ts","sourceRoot":"","sources":["../../../../src/utils/stringBuilding/perDigit.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM5C"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a non-negative integer into its full English word representation.
|
|
3
|
-
* @param num The integer to convert.
|
|
4
|
-
* @returns The word representation of the number, or an error message for invalid input.
|
|
5
|
-
*/
|
|
6
|
-
export declare function positiveInteger(num: number): string;
|
|
7
|
-
//# sourceMappingURL=positiveInteger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"positiveInteger.d.ts","sourceRoot":"","sources":["../../../../src/utils/stringBuilding/positiveInteger.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuBnD"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a given number of cents to words, provided it is a valid number between 0 and 99.
|
|
3
|
-
* @param num The number of cents to convert, as a string.
|
|
4
|
-
* @returns The word representation of the number of cents, or an empty string if the conversion failed.
|
|
5
|
-
*/
|
|
6
|
-
export declare function twoDigit(num: string): string;
|
|
7
|
-
//# sourceMappingURL=twoDigits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"twoDigits.d.ts","sourceRoot":"","sources":["../../../../src/utils/stringBuilding/twoDigits.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zeroTo999.d.ts","sourceRoot":"","sources":["../../../../src/utils/stringBuilding/zeroTo999.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA4B7C"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ExtractionResult } from "../interfaces/definitions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Validates an ExtractionResult object.
|
|
4
|
-
*
|
|
5
|
-
* Checks that the object is present, contains the required properties, and that
|
|
6
|
-
* the values of those properties are of the correct type.
|
|
7
|
-
*
|
|
8
|
-
* If the object is invalid, throws an Error with a description of the problem.
|
|
9
|
-
*
|
|
10
|
-
* @param {ExtractionResult} extractionResult - The object to validate.
|
|
11
|
-
*/
|
|
12
|
-
export declare function validateExtractionResult(extractionResult: ExtractionResult): void;
|
|
13
|
-
//# sourceMappingURL=validateExtractionResultObject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateExtractionResultObject.d.ts","sourceRoot":"","sources":["../../../src/utils/validateExtractionResultObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAehE;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CA8LjF"}
|