@borgar/fx 4.13.0 → 5.0.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 (141) hide show
  1. package/dist/index-BMr6cTgc.d.cts +1444 -0
  2. package/dist/index-BMr6cTgc.d.ts +1444 -0
  3. package/dist/index.cjs +3054 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +1 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +2984 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/xlsx/index.cjs +3120 -0
  10. package/dist/xlsx/index.cjs.map +1 -0
  11. package/dist/xlsx/index.d.cts +55 -0
  12. package/dist/xlsx/index.d.ts +55 -0
  13. package/dist/xlsx/index.js +3049 -0
  14. package/dist/xlsx/index.js.map +1 -0
  15. package/docs/API.md +2959 -718
  16. package/docs/AST_format.md +2 -2
  17. package/eslint.config.mjs +40 -0
  18. package/lib/a1.spec.ts +32 -0
  19. package/lib/a1.ts +26 -0
  20. package/lib/addA1RangeBounds.ts +50 -0
  21. package/lib/addTokenMeta.spec.ts +166 -0
  22. package/lib/{addTokenMeta.js → addTokenMeta.ts} +53 -33
  23. package/lib/astTypes.ts +211 -0
  24. package/lib/cloneToken.ts +29 -0
  25. package/lib/{constants.js → constants.ts} +6 -3
  26. package/lib/fixRanges.spec.ts +220 -0
  27. package/lib/fixRanges.ts +260 -0
  28. package/lib/fromCol.spec.ts +15 -0
  29. package/lib/{fromCol.js → fromCol.ts} +1 -1
  30. package/lib/index.spec.ts +119 -0
  31. package/lib/index.ts +76 -0
  32. package/lib/isNodeType.ts +151 -0
  33. package/lib/isType.spec.ts +208 -0
  34. package/lib/{isType.js → isType.ts} +26 -25
  35. package/lib/lexers/{advRangeOp.js → advRangeOp.ts} +1 -1
  36. package/lib/lexers/{canEndRange.js → canEndRange.ts} +2 -2
  37. package/lib/lexers/{lexBoolean.js → lexBoolean.ts} +25 -6
  38. package/lib/lexers/{lexContext.js → lexContext.ts} +14 -6
  39. package/lib/lexers/{lexError.js → lexError.ts} +3 -3
  40. package/lib/lexers/{lexFunction.js → lexFunction.ts} +3 -2
  41. package/lib/lexers/lexNameFuncCntx.ts +112 -0
  42. package/lib/lexers/{lexNamed.js → lexNamed.ts} +4 -4
  43. package/lib/lexers/{lexNewLine.js → lexNewLine.ts} +3 -2
  44. package/lib/lexers/{lexNumber.js → lexNumber.ts} +4 -3
  45. package/lib/lexers/{lexOperator.js → lexOperator.ts} +5 -4
  46. package/lib/lexers/lexRange.ts +15 -0
  47. package/lib/lexers/{lexRangeA1.js → lexRangeA1.ts} +11 -7
  48. package/lib/lexers/{lexRangeR1C1.js → lexRangeR1C1.ts} +10 -6
  49. package/lib/lexers/{lexRangeTrim.js → lexRangeTrim.ts} +3 -2
  50. package/lib/lexers/{lexRefOp.js → lexRefOp.ts} +4 -3
  51. package/lib/lexers/{lexString.js → lexString.ts} +3 -3
  52. package/lib/lexers/{lexStructured.js → lexStructured.ts} +5 -5
  53. package/lib/lexers/{lexWhitespace.js → lexWhitespace.ts} +3 -2
  54. package/lib/lexers/sets.ts +51 -0
  55. package/lib/mergeRefTokens.spec.ts +141 -0
  56. package/lib/{mergeRefTokens.js → mergeRefTokens.ts} +14 -9
  57. package/lib/nodeTypes.ts +54 -0
  58. package/lib/parse.spec.ts +1410 -0
  59. package/lib/{parser.js → parse.ts} +81 -63
  60. package/lib/parseA1Range.spec.ts +233 -0
  61. package/lib/parseA1Range.ts +206 -0
  62. package/lib/parseA1Ref.spec.ts +337 -0
  63. package/lib/parseA1Ref.ts +115 -0
  64. package/lib/parseR1C1Range.ts +191 -0
  65. package/lib/parseR1C1Ref.spec.ts +323 -0
  66. package/lib/parseR1C1Ref.ts +127 -0
  67. package/lib/parseRef.spec.ts +90 -0
  68. package/lib/parseRef.ts +240 -0
  69. package/lib/{parseSRange.js → parseSRange.ts} +15 -10
  70. package/lib/parseStructRef.spec.ts +168 -0
  71. package/lib/parseStructRef.ts +76 -0
  72. package/lib/stringifyA1Range.spec.ts +72 -0
  73. package/lib/stringifyA1Range.ts +72 -0
  74. package/lib/stringifyA1Ref.spec.ts +64 -0
  75. package/lib/stringifyA1Ref.ts +59 -0
  76. package/lib/{stringifyPrefix.js → stringifyPrefix.ts} +17 -2
  77. package/lib/stringifyR1C1Range.spec.ts +92 -0
  78. package/lib/stringifyR1C1Range.ts +73 -0
  79. package/lib/stringifyR1C1Ref.spec.ts +63 -0
  80. package/lib/stringifyR1C1Ref.ts +67 -0
  81. package/lib/stringifyStructRef.spec.ts +124 -0
  82. package/lib/stringifyStructRef.ts +113 -0
  83. package/lib/stringifyTokens.ts +15 -0
  84. package/lib/toCol.spec.ts +11 -0
  85. package/lib/{toCol.js → toCol.ts} +4 -4
  86. package/lib/tokenTypes.ts +76 -0
  87. package/lib/tokenize-srefs.spec.ts +429 -0
  88. package/lib/tokenize.spec.ts +2103 -0
  89. package/lib/tokenize.ts +346 -0
  90. package/lib/translate.spec.ts +35 -0
  91. package/lib/translateToA1.spec.ts +247 -0
  92. package/lib/translateToA1.ts +231 -0
  93. package/lib/translateToR1C1.spec.ts +227 -0
  94. package/lib/translateToR1C1.ts +145 -0
  95. package/lib/types.ts +179 -0
  96. package/lib/xlsx/index.spec.ts +27 -0
  97. package/lib/xlsx/index.ts +32 -0
  98. package/package.json +45 -31
  99. package/tsconfig.json +28 -0
  100. package/typedoc-ignore-links.ts +17 -0
  101. package/typedoc.json +41 -0
  102. package/.eslintrc +0 -22
  103. package/benchmark/benchmark.js +0 -48
  104. package/benchmark/formulas.json +0 -15677
  105. package/dist/fx.d.ts +0 -823
  106. package/dist/fx.js +0 -2
  107. package/dist/package.json +0 -1
  108. package/lib/a1.js +0 -348
  109. package/lib/a1.spec.js +0 -458
  110. package/lib/addTokenMeta.spec.js +0 -153
  111. package/lib/astTypes.js +0 -96
  112. package/lib/extraTypes.js +0 -74
  113. package/lib/fixRanges.js +0 -104
  114. package/lib/fixRanges.spec.js +0 -171
  115. package/lib/fromCol.spec.js +0 -11
  116. package/lib/index.js +0 -134
  117. package/lib/index.spec.js +0 -67
  118. package/lib/isType.spec.js +0 -168
  119. package/lib/lexer-srefs.spec.js +0 -324
  120. package/lib/lexer.js +0 -264
  121. package/lib/lexer.spec.js +0 -1953
  122. package/lib/lexers/lexRange.js +0 -8
  123. package/lib/lexers/sets.js +0 -38
  124. package/lib/mergeRefTokens.spec.js +0 -121
  125. package/lib/package.json +0 -1
  126. package/lib/parseRef.js +0 -157
  127. package/lib/parseRef.spec.js +0 -71
  128. package/lib/parseStructRef.js +0 -48
  129. package/lib/parseStructRef.spec.js +0 -164
  130. package/lib/parser.spec.js +0 -1208
  131. package/lib/rc.js +0 -341
  132. package/lib/rc.spec.js +0 -403
  133. package/lib/stringifyStructRef.js +0 -80
  134. package/lib/stringifyStructRef.spec.js +0 -182
  135. package/lib/toCol.spec.js +0 -11
  136. package/lib/translate-toA1.spec.js +0 -214
  137. package/lib/translate-toRC.spec.js +0 -197
  138. package/lib/translate.js +0 -239
  139. package/lib/translate.spec.js +0 -21
  140. package/rollup.config.mjs +0 -22
  141. package/tsd.json +0 -12
package/lib/types.ts ADDED
@@ -0,0 +1,179 @@
1
+ /**
2
+ * A formula language token.
3
+ */
4
+ export type Token = Record<string, unknown> & {
5
+ /** The type of the token */
6
+ type: string;
7
+ /** The value of the token */
8
+ value: string;
9
+ /** Signifies an unterminated string token */
10
+ unterminated?: boolean;
11
+ /** Source position offsets to the token */
12
+ loc?: number[];
13
+ };
14
+
15
+ /**
16
+ * A token with extra meta data.
17
+ */
18
+ export type TokenEnhanced = Token & {
19
+ /** A zero based position in a token list */
20
+ index: number;
21
+ /** The ID of a group which this token belongs (e.g. matching parens) */
22
+ groupId?: string;
23
+ /** This token's level of nesting inside parentheses */
24
+ depth?: number;
25
+ /** Token is of unknown type or a paren without a match */
26
+ error?: boolean;
27
+ };
28
+
29
+ /**
30
+ * A range in R1C1 style coordinates.
31
+ */
32
+ export type RangeR1C1 = {
33
+ /** Top row of the range */
34
+ r0?: number | null;
35
+ /** Bottom row of the range */
36
+ r1?: number | null;
37
+ /** Left column of the range */
38
+ c0?: number | null;
39
+ /** Right column of the range */
40
+ c1?: number | null;
41
+ /** Signifies that r0 is an absolute value */
42
+ $r0?: boolean | null;
43
+ /** Signifies that r1 is an absolute value */
44
+ $r1?: boolean | null;
45
+ /** Signifies that c0 is an absolute value */
46
+ $c0?: boolean | null;
47
+ /** Signifies that c1 is an absolute value */
48
+ $c1?: boolean | null;
49
+ /** Should empty rows and columns at the top/left or bottom/right be discarded when range is read? */
50
+ trim?: 'head' | 'tail' | 'both' | null;
51
+ };
52
+
53
+ /**
54
+ * A range in A1 style coordinates.
55
+ */
56
+ export type RangeA1 = {
57
+ /** Top row of the range */
58
+ top: number | null;
59
+ /** Left column of the range */
60
+ left: number | null;
61
+ /** Bottom row of the range */
62
+ bottom?: number | null;
63
+ /** Right column of the range */
64
+ right?: number | null;
65
+ /** Signifies that top is a "locked" value */
66
+ $top?: boolean | null;
67
+ /** Signifies that bottom is a "locked" value */
68
+ $bottom?: boolean | null;
69
+ /** Signifies that left is a "locked" value */
70
+ $left?: boolean | null;
71
+ /** Signifies that right is a "locked" value */
72
+ $right?: boolean | null;
73
+ /** Should empty rows and columns at the top/left or bottom/right be discarded when range is read? */
74
+ trim?: 'head' | 'tail' | 'both' | null;
75
+ };
76
+
77
+ /**
78
+ * A reference containing an A1 style range. See [Prefixes.md](Prefixes.md) for
79
+ * documentation on how scopes work in Fx.
80
+ */
81
+ export type ReferenceA1 = {
82
+ /** A collection of scopes for the reference */
83
+ context?: string[];
84
+ /** The reference's range */
85
+ range: RangeA1;
86
+ };
87
+
88
+ /**
89
+ * A reference containing an A1 style range. See [Prefixes.md] for
90
+ * documentation on how scopes work in Fx.
91
+ */
92
+ export type ReferenceA1Xlsx = {
93
+ /** A context workbook scope */
94
+ workbookName?: string;
95
+ /** A context sheet scope */
96
+ sheetName?: string;
97
+ /** The reference's range */
98
+ range: RangeA1;
99
+ };
100
+
101
+ /**
102
+ * A reference containing a name. See [Prefixes.md] for
103
+ * documentation on how scopes work in Fx.
104
+ */
105
+ export type ReferenceName = {
106
+ /** A collection of scopes for the reference */
107
+ context?: string[];
108
+ /** The reference's name */
109
+ name: string;
110
+ };
111
+
112
+ /**
113
+ * A reference containing a name. See [Prefixes.md] for
114
+ * documentation on how scopes work in Fx.
115
+ */
116
+ export type ReferenceNameXlsx = {
117
+ /** A context workbook scope */
118
+ workbookName?: string;
119
+ /** A context sheet scope */
120
+ sheetName?: string;
121
+ /** The reference's name */
122
+ name: string;
123
+ };
124
+
125
+ /**
126
+ * A reference containing a R1C1 style range. See [Prefixes.md] for
127
+ * documentation on how scopes work in Fx.
128
+ */
129
+ export type ReferenceR1C1 = {
130
+ /** A collection of scopes for the reference */
131
+ context?: string[];
132
+ /** The reference's range */
133
+ range: RangeR1C1;
134
+ };
135
+
136
+ /**
137
+ * A reference containing a R1C1 style range. See [Prefixes.md] for
138
+ * documentation on how scopes work in Fx.
139
+ */
140
+ export type ReferenceR1C1Xlsx = {
141
+ /** A context workbook scope */
142
+ workbookName?: string;
143
+ /** A context sheet scope */
144
+ sheetName?: string;
145
+ /** The reference's range */
146
+ range: RangeR1C1;
147
+ };
148
+
149
+ /**
150
+ * A reference containing a table slice definition. See [Prefixes.md] for
151
+ * documentation on how scopes work in Fx.
152
+ */
153
+ export type ReferenceStruct = {
154
+ /** A collection of scopes for the reference */
155
+ context?: string[];
156
+ /** The sections this reference targets */
157
+ sections?: string[];
158
+ /** The sections this reference targets */
159
+ columns?: string[];
160
+ /** The table this reference targets */
161
+ table?: string;
162
+ };
163
+
164
+ /**
165
+ * A reference containing a table slice definition. See [Prefixes.md] for
166
+ * documentation on how scopes work in Fx.
167
+ */
168
+ export type ReferenceStructXlsx = {
169
+ /** A context workbook scope */
170
+ workbookName?: string;
171
+ /** A context sheet scope */
172
+ sheetName?: string;
173
+ /** The sections this reference targets */
174
+ sections?: string[];
175
+ /** The sections this reference targets */
176
+ columns?: string[];
177
+ /** The table this reference targets */
178
+ table?: string;
179
+ };
@@ -0,0 +1,27 @@
1
+ import { describe, expect, expectTypeOf, it } from 'vitest';
2
+ import * as ctxEntry from '../index.ts';
3
+ import * as xlsxEntry from './index.ts';
4
+
5
+ // What happens when B2:A1 -> should work!
6
+ describe('xlsx interface', () => {
7
+ describe('should be the same as default one', () => {
8
+ const keys = new Set([ ...Object.keys(ctxEntry), ...Object.keys(xlsxEntry) ]);
9
+ for (const key of keys) {
10
+ it(key, () => {
11
+ // addTokenMeta is only exposed on the xlsx side
12
+ if (key === 'addTokenMeta') {
13
+ expect(typeof ctxEntry[key]).toBe('undefined');
14
+ expect(typeof xlsxEntry[key]).toBe('function');
15
+ }
16
+ else {
17
+ expectTypeOf(ctxEntry[key]).toEqualTypeOf(xlsxEntry[key]);
18
+ }
19
+ });
20
+ }
21
+ });
22
+
23
+ it('addTokenMeta exists', () => {
24
+ expect(typeof xlsxEntry.addTokenMeta === 'function').toBeTruthy();
25
+ });
26
+ });
27
+
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A tokenizer, parser, and other utilities to work with Excel formula code.
3
+ *
4
+ * The xslx entry-point methods expect and return the variant of references that uses properties.
5
+ * If you are not using xlsx files you should use the {@link fx} variant methods.
6
+ *
7
+ * See [Prefixes.md](./Prefixes.md) for documentation on how scopes work in Fx.
8
+ *
9
+ * @packageDocumentation
10
+ * @module fx/xlsx
11
+ */
12
+
13
+ export * from '../index.ts';
14
+
15
+ // only exported here, not in the parent module (because it assumes xlsx tokens)
16
+ export { addTokenMeta } from '../addTokenMeta.ts';
17
+
18
+ export {
19
+ fixTokenRangesXlsx as fixTokenRanges,
20
+ fixFormulaRangesXlsx as fixFormulaRanges
21
+ } from '../fixRanges.ts';
22
+
23
+ export { parseA1RefXlsx as parseA1Ref } from '../parseA1Ref.ts';
24
+ export { parseR1C1RefXlsx as parseR1C1Ref } from '../parseR1C1Ref.ts';
25
+ export { parseStructRefXlsx as parseStructRef } from '../parseStructRef.ts';
26
+
27
+ export { stringifyA1RefXlsx as stringifyA1Ref } from '../stringifyA1Ref.ts';
28
+ export { stringifyR1C1RefXlsx as stringifyR1C1Ref } from '../stringifyR1C1Ref.ts';
29
+ export { stringifyStructRefXlsx as stringifyStructRef } from '../stringifyStructRef.ts';
30
+
31
+ export { tokenizeXlsx as tokenize } from '../tokenize.ts';
32
+
package/package.json CHANGED
@@ -1,27 +1,46 @@
1
1
  {
2
2
  "name": "@borgar/fx",
3
- "version": "4.13.0",
3
+ "version": "5.0.0",
4
4
  "description": "Utilities for working with Excel formulas",
5
- "main": "dist/fx.js",
6
- "types": "dist/fx.d.ts",
7
- "module": "lib/index.js",
5
+ "type": "module",
8
6
  "exports": {
9
7
  ".": {
10
- "require": "./dist/fx.js",
11
- "types": "./dist/fx.d.ts",
12
- "default": "./lib/index.js"
8
+ "require": "./dist/index.cjs",
9
+ "types": "./dist/index.d.cts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./xlsx": {
13
+ "require": "./dist/xlsx/index.cjs",
14
+ "types": "./dist/xlsx/index.d.cts",
15
+ "default": "./dist/xlsx/index.js"
13
16
  }
14
17
  },
18
+ "module": "./dist/index.js",
19
+ "typings": "./dist/index.d.cts",
15
20
  "scripts": {
16
- "preversion": "npm test && npm run lint",
17
- "version": "npm run build",
18
- "lint": "eslint lib/*.js",
19
- "benchmark": "node benchmark/benchmark.js",
20
- "test": "tape lib/*.spec.js | tap-min",
21
- "build:all": "npm run build:types && npm run build:docs && npm run build",
22
- "build:types": "jsdoc -c tsd.json lib>dist/fx.d.ts",
23
- "build:docs": "echo '# _Fx_ API\n'>docs/API.md; jsdoc -t node_modules/@borgar/jsdoc-tsmd -d console lib>>docs/API.md",
24
- "build": "NODE_ENV=production rollup -c"
21
+ "benchmark": "node --experimental-strip-types benchmark/benchmark.ts",
22
+ "lint": "eslint lib/*.ts",
23
+ "test": "vitest run",
24
+ "typecheck": "tsc --noEmit",
25
+ "check": "npm run test && npm run lint && npm run typecheck",
26
+ "build": "tsup",
27
+ "build:all": "npm run docs && npm run build",
28
+ "docs": "typedoc && concat-md tempdocs > docs/API.md && rm -rf tempdocs",
29
+ "release": "git diff --exit-code && tsup && npm publish && V=$(jq -r .version package.json) && git tag -a $V -m $V && git push origin $V && gh release create $V --generate-notes"
30
+ },
31
+ "tsup": {
32
+ "entry": [
33
+ "lib/index.ts",
34
+ "lib/xlsx/index.ts"
35
+ ],
36
+ "format": [
37
+ "esm",
38
+ "cjs"
39
+ ],
40
+ "splitting": false,
41
+ "sourcemap": true,
42
+ "clean": true,
43
+ "dts": true
25
44
  },
26
45
  "repository": {
27
46
  "type": "git",
@@ -44,21 +63,16 @@
44
63
  "author": "Borgar Þorsteinsson <borgar@borgar.net> (http://borgar.net/)",
45
64
  "license": "MIT",
46
65
  "devDependencies": {
47
- "@babel/core": "~7.28.5",
48
- "@babel/eslint-parser": "~7.28.5",
49
- "@babel/preset-env": "~7.28.5",
50
- "@borgar/eslint-config": "~3.1.0",
51
- "@borgar/jsdoc-tsmd": "~0.2.2",
52
- "@rollup/plugin-babel": "~6.1.0",
53
- "@rollup/plugin-terser": "~0.4.4",
54
- "babel-eslint": "~10.1.0",
66
+ "@borgar/eslint-config": "~4.0.1",
67
+ "concat-md": "~0.5.1",
55
68
  "benchmark": "~2.1.4",
56
- "eslint": "~8.56.0",
57
- "eslint-plugin-jsdoc": "~48.1.0",
58
- "jsdoc": "~4.0.5",
59
- "rollup": "~4.52.5",
60
- "tap-min": "~3.0.0",
61
- "tape": "~5.9.0",
62
- "typescript": "~5.9.3"
69
+ "eslint": "~9.39.0",
70
+ "typescript": "~5.9.3",
71
+ "typescript-eslint": "~8.46.2",
72
+ "vitest": "~4.0.6",
73
+ "globals": "~16.5.0",
74
+ "typedoc": "~0.28.14",
75
+ "typedoc-plugin-markdown": "~4.9.0",
76
+ "tsup": "~8.5.0"
63
77
  }
64
78
  }
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "include": [
3
+ "lib/**/*",
4
+ "eslint.config.mjs",
5
+ ],
6
+ "compilerOptions": {
7
+ "jsx": "react",
8
+ "declaration": true,
9
+ "rootDir": ".",
10
+ "target": "ES2022",
11
+ "module": "NodeNext",
12
+ "moduleResolution": "NodeNext",
13
+ "allowSyntheticDefaultImports": true,
14
+ "allowImportingTsExtensions": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "verbatimModuleSyntax": true,
17
+ "erasableSyntaxOnly": true,
18
+ "allowJs": true,
19
+ "checkJs": true,
20
+ "stripInternal": true,
21
+ "noEmit": true,
22
+ "noEmitOnError": true,
23
+ "noErrorTruncation": true,
24
+ "outDir": "types",
25
+ "declarationMap": false,
26
+ "skipLibCheck": true
27
+ }
28
+ }
@@ -0,0 +1,17 @@
1
+ import { Application } from 'typedoc';
2
+
3
+ // This monkey patches typedocs logger to stop listing errors
4
+ // when it can't find markdown files in relative links.
5
+ //
6
+ // I wish there was a better way to do this, but there currently
7
+ // does not seem to be. :-(
8
+
9
+ const reRelErr = /relative path (\.\/)?\w+\.md is not a file/;
10
+ export function load (app: Application) {
11
+ const log = app.logger.log;
12
+ app.logger.log = function (msg, level) {
13
+ if (!reRelErr.test(msg)) {
14
+ log.call(app.logger, msg, level);
15
+ }
16
+ }
17
+ }
package/typedoc.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "plugin": [
3
+ "typedoc-plugin-markdown",
4
+ "./typedoc-ignore-links.ts"
5
+ ],
6
+ "out": "./tempdocs",
7
+ "entryPoints": [
8
+ "lib/index.ts",
9
+ "lib/xlsx/index.ts"
10
+ ],
11
+ "cleanOutputDir": true,
12
+ "readme": "none",
13
+ "headings": {
14
+ "readme": false,
15
+ "document": false
16
+ },
17
+ "hidePageHeader": true,
18
+ "hideBreadcrumbs": true,
19
+ "hideGenerator": true,
20
+ "useCodeBlocks": true,
21
+ "expandObjects": true,
22
+ "expandParameters": true,
23
+ "propertiesFormat": "table",
24
+ "parametersFormat": "table",
25
+ "interfacePropertiesFormat": "table",
26
+ "typeAliasPropertiesFormat": "table",
27
+ "propertyMembersFormat": "table",
28
+ "typeDeclarationFormat": "table",
29
+ "disableSources": true,
30
+ "excludeInternal": true,
31
+ "excludePrivate": true,
32
+ "excludeProtected": true,
33
+ "pageTitleTemplates": {
34
+ "member": "{name}"
35
+ },
36
+ "validation": {
37
+ "invalidLink": false,
38
+ "notExported": true,
39
+ "notDocumented": true,
40
+ }
41
+ }
package/.eslintrc DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "parser": "@babel/eslint-parser",
3
- "extends": [ "@borgar/eslint-config", "@borgar/eslint-config/jsdoc" ],
4
- "env": {
5
- "es6": true,
6
- "node": true,
7
- },
8
- "parserOptions": {
9
- "ecmaVersion": 2021,
10
- "sourceType": "module",
11
- "requireConfigFile": false,
12
- },
13
- "rules": {
14
- "no-trailing-spaces": [ "error", {
15
- "ignoreComments": true
16
- } ],
17
- "jsdoc/no-undefined-types": "off"
18
- },
19
- "globals": {
20
- "Promise"
21
- }
22
- }
@@ -1,48 +0,0 @@
1
- /* eslint-disable no-console */
2
- import { readFileSync } from 'node:fs';
3
- import benchmark from 'benchmark';
4
- import { tokenize as tokenizeCurr } from '../lib/lexer.js';
5
- import { parse as parseCurr } from '../lib/parser.js';
6
- import { tokenize as tokenizePrev, parse as parsePrev } from '../dist/fx.js';
7
-
8
- const formulas = JSON.parse(readFileSync('benchmark/formulas.json', 'utf8'));
9
-
10
- function runSuite (title, current, previous) {
11
- return new Promise(resolve => {
12
- console.log('Running benchmark for ' + title);
13
- // @ts-ignore
14
- (new benchmark.Benchmark.Suite())
15
- .add('lib/' + title, () => {
16
- for (const expr of formulas) {
17
- try {
18
- current(expr);
19
- }
20
- catch (err) {
21
- // gulp
22
- }
23
- }
24
- })
25
- .add('dist/' + title, () => {
26
- for (const expr of formulas) {
27
- try {
28
- previous(expr);
29
- }
30
- catch (err) {
31
- // gulp
32
- }
33
- }
34
- })
35
- .on('cycle', event => {
36
- console.log(' ', String(event.target));
37
- })
38
- .on('complete', function () {
39
- // console.log(' 🥇', this.filter('fastest').map('name')[0]);
40
- console.log('');
41
- resolve(true);
42
- })
43
- .run({ async: true });
44
- });
45
- }
46
-
47
- await runSuite('tokenizer', tokenizeCurr, tokenizePrev);
48
- await runSuite('parser', parseCurr, parsePrev);