@signpostmarv/intermediary-number 0.6.2 → 0.6.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/README.md CHANGED
@@ -9,17 +9,14 @@ Intermediary Number classes & utilities for the [Production Calculator](https://
9
9
 
10
10
  ### Requirements
11
11
 
12
- - Docker
13
- - vscode recommended to use devcontainer support
12
+ - Docker
13
+ - vscode recommended to use devcontainer support
14
14
 
15
15
  ### Setup
16
16
 
17
17
  1. Checkout locally
18
18
  1. Load in devcontainer-supporting IDE
19
- - devcontainer setup should automatically run `make install`
20
- - `NODE_OPTIONS` env var may require opening a fresh terminal if you
21
- receieve an error along the lines of
22
- `TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"`
19
+ - devcontainer setup should automatically run `npm install`
23
20
  1. Run `make generate`
24
21
 
25
22
  ## Documentation
@@ -30,5 +27,5 @@ Please refer to the tests in the meantime.
30
27
 
31
28
  ## Issues
32
29
 
33
- - Issue tracker for all the related projects except Docs.json.ts are [available on GitHub](https://github.com/orgs/satisfactory-dev/projects/1).
34
- - [Issues with Docs.json.ts currently need to be viewed separately](https://github.com/satisfactory-dev/Docs.json.ts/issues).
30
+ - Issue tracker for all the related projects except Docs.json.ts are [available on GitHub](https://github.com/orgs/satisfactory-dev/projects/1).
31
+ - [Issues with Docs.json.ts currently need to be viewed separately](https://github.com/satisfactory-dev/Docs.json.ts/issues).
package/package.json CHANGED
@@ -12,20 +12,18 @@
12
12
  "types": "./index.d.ts",
13
13
  "devDependencies": {
14
14
  "@satisfactory-dev/custom-assert": "^0.2.3",
15
- "@signpostmarv/eslint-config": "^0.2.0",
16
- "@types/eslint": "^9.6.0",
17
- "@types/node": "^20.14.2",
18
- "c8": "^10.1.2",
19
- "eslint": "^9.9.1",
20
- "glob": "^10.4.1",
21
- "prettier": "^3.3.2",
22
- "ts-node": "^10.9.2",
23
- "typescript": "~5.5.2",
24
- "typescript-eslint": "^8.2.0"
15
+ "@signpostmarv/eslint-config": "^0.5.0",
16
+ "@types/eslint": "^9.6.1",
17
+ "@types/node": "^24.10.4",
18
+ "c8": "^10.1.3",
19
+ "eslint": "^9.39.2",
20
+ "prettier": "^3.7.4",
21
+ "typescript": "~5.9.2",
22
+ "typescript-eslint": "^8.50.0"
25
23
  },
26
24
  "dependencies": {
27
25
  "bignumber.js": "^9.1.2",
28
26
  "fraction.js": "^4.3.7"
29
27
  },
30
- "version": "0.6.2"
28
+ "version": "0.6.3"
31
29
  }
package/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './lib/IntermediaryNumber';
2
- export * from './lib/IntermediaryNumberTypes';
3
- export * from './lib/Numbers';
4
- export * from './lib/NumberStrings';
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './lib/IntermediaryNumber';
2
- export * from './lib/IntermediaryNumberTypes';
3
- export * from './lib/Numbers';
4
- export * from './lib/NumberStrings';
@@ -1,7 +0,0 @@
1
- export declare class NotAnAmountString extends Error {
2
- }
3
- export type StringPassedRegExp<pattern extends string, T extends string = string> = T & {
4
- [pseudo_key in pattern]: never;
5
- };
6
- export type integer_string__type = StringPassedRegExp<'^\\d+$'>;
7
- export declare function is_string(maybe: unknown): maybe is string;
package/lib/Docs.json.js DELETED
@@ -1,6 +0,0 @@
1
- // exports from Docs.json.ts not really warranting their own package
2
- export class NotAnAmountString extends Error {
3
- }
4
- export function is_string(maybe) {
5
- return 'string' === typeof maybe;
6
- }
@@ -1,221 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import Fraction from 'fraction.js';
3
- import { amount_string } from './NumberStrings';
4
- import type { input_types, type_property_types, value_types } from './IntermediaryNumberTypes';
5
- export type math_types = operand_types | input_types;
6
- export declare const regex_recurring_number: RegExp;
7
- export type CanDoMath_result_types = IntermediaryNumber | IntermediaryCalculation | TokenScan;
8
- export type operation_types = '+' | '-' | '*' | 'x' | '/' | '%';
9
- export type operand_type_property_types = type_property_types | 'IntermediaryCalculation' | 'TokenScan';
10
- export type CanConvertTypeJson = {
11
- type: 'IntermediaryNumber';
12
- value: string;
13
- } | {
14
- type: 'IntermediaryCalculation';
15
- left: CanConvertTypeJson;
16
- operation: operation_types;
17
- right: CanConvertTypeJson;
18
- } | {
19
- type: 'TokenScan';
20
- value: string;
21
- };
22
- export type CanDoMathWithDispose_operator_types = 'divide' | 'minus' | 'modulo' | 'plus' | 'times';
23
- export type operand_types = IntermediaryNumber | IntermediaryCalculation | TokenScan;
24
- type TokenSpan_types = 'ignore' | 'nesting_open' | 'nesting_close' | 'numeric' | 'operation' | 'Infinity';
25
- type TokenSpan_types_part_baked = Exclude<TokenSpan_types, 'ignore'>;
26
- type TokenScan_internals = {
27
- parsed: IntermediaryNumber | IntermediaryCalculation | undefined;
28
- tokens: (TokenSpan<TokenSpan_types_part_baked>[]) | undefined;
29
- valid: boolean | undefined;
30
- };
31
- type TokenScan_parsing_value = Omit<TokenScan, 'is_valid' | 'parsed'>;
32
- type TokenScan_tokenizer_operand_buffer = IntermediaryNumber | IntermediaryCalculation | undefined;
33
- type incomplete_operation = {
34
- left_operand: Exclude<TokenScan_tokenizer_operand_buffer, undefined>;
35
- operation: operation_types;
36
- };
37
- type TokenScan_tokenizer = {
38
- outter_stack: (incomplete_operation | TokenSpan<'nesting_open'>)[];
39
- left_operand: TokenScan_tokenizer_operand_buffer;
40
- right_operand: TokenScan_tokenizer_operand_buffer;
41
- operation: '' | operation_types;
42
- operand_mode: 'left' | 'right';
43
- };
44
- interface HasType {
45
- get type(): operand_type_property_types;
46
- }
47
- interface CanDoMath<ResultType extends CanDoMath_result_types = CanDoMath_result_types, ResolveString extends string = type_property_types> extends HasType {
48
- get resolve_type(): ResolveString;
49
- compare(value: math_types): -1 | 0 | 1;
50
- divide(value: math_types): ResultType;
51
- minus(value: math_types): ResultType;
52
- modulo(value: math_types): ResultType;
53
- plus(value: math_types): ResultType;
54
- times(value: math_types): ResultType;
55
- abs(): (operand_types);
56
- max(first: math_types, ...remaining: math_types[]): operand_types;
57
- min(first: math_types, ...remaining: math_types[]): operand_types;
58
- }
59
- interface CanResolveMath<T extends CanDoMath_result_types = CanDoMath_result_types> extends CanDoMath<T, string> {
60
- resolve(): IntermediaryNumber;
61
- }
62
- export interface CanConvertType extends HasType {
63
- toAmountString(): amount_string;
64
- toBigNumber(): BigNumber;
65
- toBigNumberOrFraction(): BigNumber | Fraction;
66
- toFraction(): Fraction;
67
- toString(): string;
68
- isLessThan(value: math_types): boolean;
69
- isGreaterThan(value: math_types): boolean;
70
- isOne(): boolean;
71
- isZero(): boolean;
72
- toJSON(): CanConvertTypeJson;
73
- }
74
- interface CanDoMathWithDispose<ResultType extends CanDoMath_result_types = CanDoMath_result_types, ResolveString extends string = type_property_types> extends CanConvertType, CanDoMath<ResultType, ResolveString> {
75
- do_math_then_dispose(operator: CanDoMathWithDispose_operator_types, right_operand: math_types): ResultType;
76
- }
77
- interface CanResolveMathWithDispose<T extends CanDoMath_result_types = CanDoMath_result_types> extends CanResolveMath<T>, CanDoMathWithDispose<T, string> {
78
- }
79
- export declare function dispose(value: operand_types): void;
80
- export declare function is_operation_value(maybe: string): asserts maybe is operation_types;
81
- export declare class IntermediaryNumber implements CanDoMathWithDispose {
82
- private readonly value;
83
- static readonly One: IntermediaryNumber;
84
- static readonly Zero: IntermediaryNumber;
85
- protected constructor(value: value_types);
86
- get resolve_type(): type_property_types;
87
- get type(): type_property_types;
88
- abs(): operand_types;
89
- compare(value: math_types): 0 | 1 | -1;
90
- divide(value: math_types): operand_types;
91
- do_math_then_dispose(operator: CanDoMathWithDispose_operator_types, right_operand: math_types): CanDoMath_result_types;
92
- isGreaterThan(value: math_types): boolean;
93
- isLessThan(value: math_types): boolean;
94
- isOne(): boolean;
95
- isZero(): boolean;
96
- max(first: math_types, ...remaining: math_types[]): operand_types;
97
- min(first: math_types, ...remaining: math_types[]): operand_types;
98
- minus(value: math_types): operand_types;
99
- modulo(value: math_types): operand_types;
100
- plus(value: math_types): operand_types;
101
- times(value: math_types): operand_types;
102
- toAmountString(): amount_string;
103
- toBigNumber(): BigNumber;
104
- toBigNumberOrFraction(): BigNumber | Fraction;
105
- toFraction(): Fraction;
106
- toJSON(): CanConvertTypeJson;
107
- toString(): string;
108
- toStringCalculation(): string;
109
- static create(input: input_types): IntermediaryNumber;
110
- static create_if_valid(input: string): operand_types | NotValid;
111
- static fromJson(json: CanConvertTypeJson): CanDoMath_result_types;
112
- static reuse_or_create(input: operand_types | input_types): operand_types;
113
- }
114
- export declare class IntermediaryNumberInfinity extends IntermediaryNumber {
115
- static readonly One: IntermediaryNumberInfinity;
116
- static readonly Zero: IntermediaryNumberInfinity;
117
- isOne(): boolean;
118
- isZero(): boolean;
119
- toFraction(): Fraction;
120
- toString(): string;
121
- toStringCalculation(): string;
122
- }
123
- export declare class NotValid extends Error {
124
- readonly reason: unknown;
125
- readonly value: string;
126
- constructor(not_valid: string, reason: unknown);
127
- }
128
- export declare class IntermediaryCalculation implements CanResolveMathWithDispose {
129
- readonly left_operand: operand_types;
130
- readonly operation: operation_types;
131
- readonly right_operand: operand_types;
132
- constructor(left: operand_types, operation: operation_types, right: operand_types);
133
- get has_infinity(): boolean;
134
- get left_type(): operand_type_property_types;
135
- get resolve_type(): string;
136
- get right_type(): operand_type_property_types;
137
- get type(): operand_type_property_types;
138
- abs(): operand_types;
139
- compare(value: math_types): 0 | 1 | -1;
140
- divide(value: math_types): operand_types;
141
- do_math_then_dispose(operator: CanDoMathWithDispose_operator_types, right_operand: math_types): CanDoMath_result_types;
142
- isGreaterThan(value: math_types): boolean;
143
- isLessThan(value: math_types): boolean;
144
- isOne(): boolean;
145
- isZero(): boolean;
146
- max(first: math_types, ...remaining: math_types[]): operand_types;
147
- min(first: math_types, ...remaining: math_types[]): operand_types;
148
- minus(value: math_types): operand_types;
149
- modulo(value: math_types): operand_types;
150
- plus(value: math_types): operand_types;
151
- resolve(): IntermediaryNumber;
152
- times(value: math_types): operand_types;
153
- toAmountString(): amount_string;
154
- toBigNumber(): BigNumber;
155
- toBigNumberOrFraction(): BigNumber | Fraction;
156
- toFraction(): Fraction;
157
- toJSON(): CanConvertTypeJson;
158
- toString(): string;
159
- toStringCalculation(): string;
160
- private operand_to_IntermediaryNumber;
161
- static fromString(input: Exclude<string, ''>): IntermediaryNumber | IntermediaryCalculation;
162
- static is(maybe: unknown): maybe is IntermediaryCalculation;
163
- static maybe_reduce_operands(left: operand_types, operation: operation_types, right: operand_types): IntermediaryNumber | TokenScan;
164
- static require_is(maybe: unknown): asserts maybe is IntermediaryCalculation;
165
- private static maybe_short_circuit;
166
- }
167
- declare class TokenSpan<T = TokenSpan_types> {
168
- readonly from: number;
169
- readonly to: number;
170
- readonly type: T;
171
- constructor(from: number, to: number, type: T);
172
- }
173
- export declare class TokenScanError extends Error {
174
- }
175
- export declare class TokenScanParseError extends Error {
176
- readonly current?: TokenSpan<TokenSpan_types>;
177
- readonly scan: TokenScan_parsing_value;
178
- readonly state?: TokenScan_tokenizer;
179
- constructor(message: string, scan: TokenScan_parsing_value, state: TokenScan_tokenizer, current?: TokenSpan<TokenSpan_types>);
180
- }
181
- export declare class TokenScan implements CanResolveMathWithDispose {
182
- #private;
183
- private readonly internal;
184
- readonly value: string | [TokenScan, operation_types, math_types];
185
- private constructor();
186
- get parsed(): Exclude<TokenScan_internals['parsed'], undefined>;
187
- get resolve_type(): string;
188
- get tokens(): Exclude<TokenScan_internals['tokens'], undefined>;
189
- get type(): operand_type_property_types;
190
- get valid(): boolean;
191
- abs(): operand_types;
192
- compare(value: math_types): 0 | 1 | -1;
193
- divide(value: math_types): TokenScan;
194
- do_math_then_dispose(operator: CanDoMathWithDispose_operator_types, right_operand: math_types): CanDoMath_result_types;
195
- isGreaterThan(value: math_types): boolean;
196
- isLessThan(value: math_types): boolean;
197
- isOne(): boolean;
198
- isZero(): boolean;
199
- max(first: math_types, ...remaining: math_types[]): operand_types;
200
- min(first: math_types, ...remaining: math_types[]): operand_types;
201
- minus(value: math_types): TokenScan;
202
- modulo(value: math_types): TokenScan;
203
- plus(value: math_types): TokenScan;
204
- resolve(): IntermediaryNumber;
205
- times(value: math_types): TokenScan;
206
- toAmountString(): amount_string;
207
- toBigNumber(): BigNumber;
208
- toBigNumberOrFraction(): BigNumber | Fraction;
209
- toFraction(): Fraction;
210
- toJSON(): CanConvertTypeJson;
211
- toString(): string;
212
- toStringCalculation(): string;
213
- static create(value: string): TokenScan;
214
- static is(maybe: unknown): maybe is TokenScan;
215
- static require_is(maybe: unknown): asserts maybe is TokenScan;
216
- private static determine_tokens_from_scan;
217
- private static massage_part_baked_tokens;
218
- private static parse_scan;
219
- private static reduce;
220
- }
221
- export {};