@borgar/fx 4.7.0 → 4.7.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.
package/dist/fx.d.ts CHANGED
@@ -111,15 +111,6 @@ export declare function fixRanges(formula: (string | Array<Token>), options?: {
111
111
  xlsx?: boolean;
112
112
  }): (string | Array<Token>);
113
113
 
114
- /**
115
- * Parse a simple string reference to an A1 range into a range object.
116
- * Will accept `A1`, `A2`, `A:A`, or `1:1`.
117
- *
118
- * @param rangeString A range string
119
- * @returns An object representing a valid range or null if it is invalid.
120
- */
121
- declare function fromA1(rangeString: string): (RangeA1 | null);
122
-
123
114
  /**
124
115
  * Convert a column string representation to a 0 based
125
116
  * offset number (`"C"` = `2`).
@@ -132,14 +123,6 @@ declare function fromA1(rangeString: string): (RangeA1 | null);
132
123
  */
133
124
  export declare function fromCol(columnString: string): number;
134
125
 
135
- /**
136
- * Parse a simple string reference to an R1C1 range into a range object.
137
- *
138
- * @param rangeString A range string
139
- * @returns An object representing a valid reference or null if it is invalid.
140
- */
141
- declare function fromR1C1(rangeString: string): (RangeR1C1 | null);
142
-
143
126
  /**
144
127
  * Determines whether the specified token is an error.
145
128
  * Returns `true` if the input is a token of type ERROR (`#VALUE!`). In all
@@ -447,14 +430,6 @@ export declare function stringifyStructRef(refObject: ReferenceStruct, options?:
447
430
  xlsx?: boolean;
448
431
  }): string;
449
432
 
450
- /**
451
- * Stringify a range object into A1 syntax.
452
- *
453
- * @param range A range object
454
- * @returns An A1-style string represenation of a range
455
- */
456
- declare function toA1(range: RangeA1): string;
457
-
458
433
  /**
459
434
  * Convert a 0 based offset number to a column string
460
435
  * representation (`2` = `"C"`).
@@ -466,14 +441,6 @@ declare function toA1(range: RangeA1): string;
466
441
  */
467
442
  export declare function toCol(columnIndex: number): string;
468
443
 
469
- /**
470
- * Stringify a range object into R1C1 syntax.
471
- *
472
- * @param range A range object
473
- * @returns An R1C1-style string represenation of a range
474
- */
475
- declare function toR1C1(range: RangeR1C1): string;
476
-
477
444
  /**
478
445
  * Breaks a string formula into a list of tokens.
479
446
  * The returned output will be an array of objects representing the tokens:
package/docs/API.md CHANGED
@@ -5,9 +5,7 @@
5
5
  - [addA1RangeBounds( range )](#addA1RangeBounds)
6
6
  - [addTokenMeta( tokenlist, _\[context\]_ )](#addTokenMeta)
7
7
  - [fixRanges( formula, _\[options\]_ )](#fixRanges)
8
- - [fromA1( rangeString )](#fromA1)
9
8
  - [fromCol( columnString )](#fromCol)
10
- - [fromR1C1( rangeString )](#fromR1C1)
11
9
  - [isError( token )](#isError)
12
10
  - [isFunction( token )](#isFunction)
13
11
  - [isFxPrefix( token )](#isFxPrefix)
@@ -24,9 +22,7 @@
24
22
  - [stringifyA1Ref( refObject, _\[options\]_ )](#stringifyA1Ref)
25
23
  - [stringifyR1C1Ref( refObject, _\[options\]_ )](#stringifyR1C1Ref)
26
24
  - [stringifyStructRef( refObject, _\[options\]_ )](#stringifyStructRef)
27
- - [toA1( range )](#toA1)
28
25
  - [toCol( columnIndex )](#toCol)
29
- - [toR1C1( range )](#toR1C1)
30
26
  - [tokenize( formula, _\[options\]_ )](#tokenize)
31
27
  - [translateToA1( formula, anchorCell, _\[options\]_ )](#translateToA1)
32
28
  - [translateToR1C1( formula, anchorCell, _\[options\]_ )](#translateToR1C1)
@@ -177,24 +173,6 @@ Returns the same formula with the ranges updated. If an array of tokens was supp
177
173
 
178
174
  ---
179
175
 
180
- ### <a id="fromA1" href="#fromA1">#</a> fromA1( rangeString ) ⇒ [`RangeA1`](#RangeA1) | `null`
181
-
182
- Parse a simple string reference to an A1 range into a range object. Will accept `A1`, `A2`, `A:A`, or `1:1`.
183
-
184
- **See also:** [parseA1Ref](#parseA1Ref).
185
-
186
- ##### Parameters
187
-
188
- | Name | Type | Description |
189
- | ----------- | -------- | -------------- |
190
- | rangeString | `string` | A range string |
191
-
192
- ##### Returns
193
-
194
- [`RangeA1`](#RangeA1) | `null` – An object representing a valid range or null if it is invalid.
195
-
196
- ---
197
-
198
176
  ### <a id="fromCol" href="#fromCol">#</a> fromCol( columnString ) ⇒ `number`
199
177
 
200
178
  Convert a column string representation to a 0 based offset number (`"C"` = `2`).
@@ -213,24 +191,6 @@ The method expects a valid column identifier made up of _only_ A-Z letters, whic
213
191
 
214
192
  ---
215
193
 
216
- ### <a id="fromR1C1" href="#fromR1C1">#</a> fromR1C1( rangeString ) ⇒ [`RangeR1C1`](#RangeR1C1) | `null`
217
-
218
- Parse a simple string reference to an R1C1 range into a range object.
219
-
220
- **See also:** [parseA1Ref](#parseA1Ref).
221
-
222
- ##### Parameters
223
-
224
- | Name | Type | Description |
225
- | ----------- | -------- | -------------- |
226
- | rangeString | `string` | A range string |
227
-
228
- ##### Returns
229
-
230
- [`RangeR1C1`](#RangeR1C1) | `null` – An object representing a valid reference or null if it is invalid.
231
-
232
- ---
233
-
234
194
  ### <a id="isError" href="#isError">#</a> isError( token ) ⇒ `boolean`
235
195
 
236
196
  Determines whether the specified token is an error.
@@ -399,7 +359,7 @@ The parser requires `mergeRefs` to have been `true` in tokenlist options, becaus
399
359
 
400
360
  The AST Abstract Syntax Tree's format is documented in [AST_format.md](./AST_format.md)
401
361
 
402
- **See also:** [nodeTypes](#nodeTypes).
362
+ **See also:** [nodeTypes](#nodeTypes).
403
363
 
404
364
  ##### Parameters
405
365
 
@@ -626,24 +586,6 @@ stringifyStructRef({
626
586
 
627
587
  ---
628
588
 
629
- ### <a id="toA1" href="#toA1">#</a> toA1( range ) ⇒ `string`
630
-
631
- Stringify a range object into A1 syntax.
632
-
633
- **See also:** [parseA1Ref](#parseA1Ref).
634
-
635
- ##### Parameters
636
-
637
- | Name | Type | Description |
638
- | ----- | --------------------- | -------------- |
639
- | range | [`RangeA1`](#RangeA1) | A range object |
640
-
641
- ##### Returns
642
-
643
- `string` – An A1-style string represenation of a range
644
-
645
- ---
646
-
647
589
  ### <a id="toCol" href="#toCol">#</a> toCol( columnIndex ) ⇒ `string`
648
590
 
649
591
  Convert a 0 based offset number to a column string representation (`2` = `"C"`).
@@ -662,24 +604,6 @@ The method expects a number between 0 and 16383. Other input will return garbage
662
604
 
663
605
  ---
664
606
 
665
- ### <a id="toR1C1" href="#toR1C1">#</a> toR1C1( range ) ⇒ `string`
666
-
667
- Stringify a range object into R1C1 syntax.
668
-
669
- **See also:** [parseR1C1Ref](#parseR1C1Ref).
670
-
671
- ##### Parameters
672
-
673
- | Name | Type | Description |
674
- | ----- | ------------------------- | -------------- |
675
- | range | [`RangeR1C1`](#RangeR1C1) | A range object |
676
-
677
- ##### Returns
678
-
679
- `string` – An R1C1-style string represenation of a range
680
-
681
- ---
682
-
683
607
  ### <a id="tokenize" href="#tokenize">#</a> tokenize( formula, _[options = `{}`]_ ) ⇒ `Array<Token>`
684
608
 
685
609
  Breaks a string formula into a list of tokens.
@@ -707,7 +631,7 @@ To support syntax highlighting as you type, `STRING` tokens are allowed to be "u
707
631
  ]
708
632
  ```
709
633
 
710
- **See also:** [tokenTypes](#tokenTypes).
634
+ **See also:** [tokenTypes](#tokenTypes).
711
635
 
712
636
  ##### Parameters
713
637
 
@@ -802,7 +726,7 @@ translateToR1C1("=SUM(E10,$E$2,Sheet!$E$3)", "D10");
802
726
 
803
727
  A dictionary of the types used to identify AST node variants.
804
728
 
805
- **See also:** [parse](#parse).
729
+ **See also:** [parse](#parse).
806
730
 
807
731
  ##### Properties
808
732
 
@@ -823,7 +747,7 @@ A dictionary of the types used to identify AST node variants.
823
747
 
824
748
  A dictionary of the types used to identify token variants.
825
749
 
826
- **See also:** [tokenize](#tokenize).
750
+ **See also:** [tokenize](#tokenize).
827
751
 
828
752
  ##### Properties
829
753
 
package/docs/Prefixes.md CHANGED
@@ -63,7 +63,7 @@ When Excel saves a workbook to one of its XML formats (most commonly as .xlsx) i
63
63
  * `[a]!`
64
64
  * `[a]b!`
65
65
 
66
- Since the XML files only ever emitted with positive integer indexes instead of workbook names, whether the syntax allows anything else is open. _Fx_ chooses to be permissive in handling this variant and allows `[Workbook.xlsx]!A1` forms as well as `[1]!A1`.
66
+ Since the XML files only ever emitted with positive integer indexes instead of workbook names, whether the syntax allows anything else is speculative. _Fx_ chooses to be permissive in handling this variant and allows `[Workbook.xlsx]!A1` forms as well as `[1]!A1`.
67
67
 
68
68
  Why the formula language does not use this unambiguous and somewhat more intuitive variant rather than the above form is a question for Excel historians, likely this later form was introduced with the XML format to eliminate the ambiguity?
69
69
 
package/lib/a1.js CHANGED
@@ -84,6 +84,7 @@ export function toAbsolute (range) {
84
84
  * Stringify a range object into A1 syntax.
85
85
  *
86
86
  * @private
87
+ * @ignore
87
88
  * @see parseA1Ref
88
89
  * @param {RangeA1} range A range object
89
90
  * @returns {string} An A1-style string represenation of a range
@@ -161,6 +162,7 @@ function splitA1 (str) {
161
162
  * Will accept `A1`, `A2`, `A:A`, or `1:1`.
162
163
  *
163
164
  * @private
165
+ * @ignore
164
166
  * @see parseA1Ref
165
167
  * @param {string} rangeString A range string
166
168
  * @returns {(RangeA1|null)} An object representing a valid range or null if it is invalid.
@@ -0,0 +1,67 @@
1
+ import { test } from 'tape';
2
+
3
+ import {
4
+ addA1RangeBounds,
5
+ addTokenMeta,
6
+ fixRanges,
7
+ fromCol,
8
+ isError,
9
+ isFunction,
10
+ isFxPrefix,
11
+ isLiteral,
12
+ isOperator,
13
+ isRange,
14
+ isReference,
15
+ isWhitespace,
16
+ mergeRefTokens,
17
+ nodeTypes,
18
+ parse,
19
+ parseA1Ref,
20
+ parseR1C1Ref,
21
+ parseStructRef,
22
+ stringifyA1Ref,
23
+ stringifyR1C1Ref,
24
+ stringifyStructRef,
25
+ toCol,
26
+ tokenize,
27
+ tokenTypes,
28
+ translateToA1,
29
+ translateToR1C1
30
+ } from './index.js';
31
+
32
+ // What happens when B2:A1 -> should work!
33
+ test('fx main interface', t => {
34
+ t.ok(typeof addA1RangeBounds === 'function', 'addA1RangeBounds exists');
35
+ t.ok(typeof addTokenMeta === 'function', 'addTokenMeta exists');
36
+ t.ok(typeof fixRanges === 'function', 'fixRanges exists');
37
+
38
+ t.ok(typeof fromCol === 'function', 'fromCol exists');
39
+
40
+ t.ok(typeof isError === 'function', 'isError exists');
41
+ t.ok(typeof isFunction === 'function', 'isFunction exists');
42
+ t.ok(typeof isFxPrefix === 'function', 'isFxPrefix exists');
43
+ t.ok(typeof isLiteral === 'function', 'isLiteral exists');
44
+ t.ok(typeof isOperator === 'function', 'isOperator exists');
45
+ t.ok(typeof isRange === 'function', 'isRange exists');
46
+ t.ok(typeof isReference === 'function', 'isReference exists');
47
+ t.ok(typeof isWhitespace === 'function', 'isWhitespace exists');
48
+
49
+ t.ok(typeof mergeRefTokens === 'function', 'mergeRefTokens exists');
50
+ t.ok(typeof parse === 'function', 'parse exists');
51
+ t.ok(typeof parseA1Ref === 'function', 'parseA1Ref exists');
52
+ t.ok(typeof parseR1C1Ref === 'function', 'parseR1C1Ref exists');
53
+ t.ok(typeof parseStructRef === 'function', 'parseStructRef exists');
54
+ t.ok(typeof stringifyA1Ref === 'function', 'stringifyA1Ref exists');
55
+ t.ok(typeof stringifyR1C1Ref === 'function', 'stringifyR1C1Ref exists');
56
+ t.ok(typeof stringifyStructRef === 'function', 'stringifyStructRef exists');
57
+ t.ok(typeof toCol === 'function', 'toCol exists');
58
+ t.ok(typeof tokenize === 'function', 'tokenize exists');
59
+ t.ok(typeof translateToA1 === 'function', 'translateToA1 exists');
60
+ t.ok(typeof translateToR1C1 === 'function', 'translateToR1C1 exists');
61
+
62
+ t.ok(typeof nodeTypes === 'object', 'nodeTypes exists');
63
+ t.ok(typeof tokenTypes === 'object', 'tokenTypes exists');
64
+
65
+ t.end();
66
+ });
67
+
package/lib/rc.js CHANGED
@@ -22,6 +22,7 @@ function toCoord (value, isAbs) {
22
22
  /**
23
23
  * Stringify a range object into R1C1 syntax.
24
24
  *
25
+ * @ignore
25
26
  * @private
26
27
  * @see parseR1C1Ref
27
28
  * @param {RangeR1C1} range A range object
@@ -132,6 +133,7 @@ function parseR1C1Part (ref) {
132
133
  * Parse a simple string reference to an R1C1 range into a range object.
133
134
  *
134
135
  * @private
136
+ * @ignore
135
137
  * @see parseA1Ref
136
138
  * @param {string} rangeString A range string
137
139
  * @returns {(RangeR1C1|null)} An object representing a valid reference or null if it is invalid.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@borgar/fx",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "description": "Utilities for working with Excel formulas",
5
5
  "main": "dist/fx.js",
6
6
  "types": "dist/fx.d.ts",