@danielsimonjr/mathts-functions 0.8.0 → 0.9.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.
@@ -1,227 +0,0 @@
1
- /**
2
- * Shared TypeScript interfaces for the Unit factory (`Unit.ts`).
3
- *
4
- * The Unit type is a "function-as-class" (a constructor function whose
5
- * prototype is built up imperatively) ported from mathjs. These interfaces
6
- * describe the runtime shapes precisely so `Unit.ts` can be fully type-checked
7
- * under strict mode without suppression directives or escape-hatch typing.
8
- *
9
- * @module @danielsimonjr/mathts-functions/type/unit/unit-types
10
- */
11
- import type { Complex } from '../../utils/is.js';
12
- /** A complex number value (re/im pair), as produced by the `Complex` type. */
13
- export type ComplexValue = Complex;
14
- /**
15
- * Minimal structural view of a BigNumber value: only the instance methods that
16
- * the Unit factory actually calls when computing angle constants.
17
- */
18
- export interface BigNumberValue {
19
- div(other: BigNumberValue | number | string): BigNumberValue;
20
- times(other: BigNumberValue | number | string): BigNumberValue;
21
- }
22
- /** Structural view of a Fraction value (numerator/denominator/sign). */
23
- export interface FractionValue {
24
- n: number;
25
- d: number;
26
- s: number;
27
- isFraction?: boolean;
28
- }
29
- /**
30
- * Any numeric value a Unit can carry. Mirrors what `isNumeric`/`isComplex`
31
- * accept at the constructor boundary (number, bigint, boolean, BigNumber,
32
- * Fraction, Complex). Boolean/bigint flow through unchanged for valueless
33
- * units and are coerced by the scalar operations otherwise.
34
- */
35
- export type Numeric = number | bigint | boolean | BigNumberValue | FractionValue | ComplexValue;
36
- /** A prefix definition such as `{ name: 'k', value: 1e3, scientific: true }`. */
37
- export interface PrefixDef {
38
- name: string;
39
- value: number;
40
- scientific: boolean;
41
- }
42
- /** A named table of prefixes (e.g. PREFIXES.SHORT), keyed by prefix name. */
43
- export type PrefixTable = Record<string, PrefixDef>;
44
- /** A base dimension definition (the 9-element exponent vector + its key). */
45
- export interface BaseUnitDef {
46
- dimensions: number[];
47
- key?: string;
48
- }
49
- /**
50
- * A unit definition entry in the UNITS table. `dimensions` and `base.key` are
51
- * populated after the literal is created (see the module-init loops), hence
52
- * optional; `value` is `null` for angle units until `calculateAngleValues`
53
- * runs at module init, before any unit is parsed.
54
- */
55
- export interface UnitDef {
56
- name: string;
57
- base?: BaseUnitDef;
58
- prefixes?: PrefixTable;
59
- value: Numeric | null;
60
- offset: number;
61
- dimensions?: number[];
62
- reciprocal?: boolean;
63
- }
64
- /** A single component of a Unit's unit list (e.g. the `m` in `m/s^2`). */
65
- export interface UnitComponent {
66
- unit: UnitDef;
67
- prefix: PrefixDef;
68
- power: number;
69
- }
70
- /** An entry in a unit system, pairing a unit with a default prefix. */
71
- export interface UnitSystemEntry {
72
- unit: UnitDef;
73
- prefix: PrefixDef;
74
- }
75
- /** A unit system (e.g. `si`, `cgs`, `us`, `auto`), keyed by base-dimension. */
76
- export type UnitSystem = Record<string, UnitSystemEntry>;
77
- /** JSON serialization shape produced by `Unit#toJSON`. */
78
- export interface UnitJSON {
79
- mathjs: 'Unit';
80
- value: Numeric | null;
81
- unit: string | null;
82
- fixPrefix: boolean;
83
- skipSimp: boolean;
84
- }
85
- /** A numeric-type converter (number → BigNumber/Fraction/Complex/number). */
86
- export type ConverterFn = (x: Numeric) => Numeric;
87
- /** The table of numeric-type converters exposed on `Unit.typeConverters`. */
88
- export interface TypeConverters {
89
- BigNumber: ConverterFn;
90
- Fraction: ConverterFn;
91
- Complex: ConverterFn;
92
- number: ConverterFn;
93
- [key: string]: ConverterFn;
94
- }
95
- /** Options accepted by `Unit.parse`. */
96
- export interface ParseOptions {
97
- allowNoUnits?: boolean;
98
- }
99
- /** Formatting options accepted by `Unit#format` / `Unit#toBest`. */
100
- export interface UnitFormatOptions {
101
- offset?: number;
102
- [key: string]: unknown;
103
- }
104
- /** Options accepted by `Unit.createUnit`. */
105
- export interface CreateUnitOptions {
106
- override?: boolean;
107
- }
108
- /** Object form of a `createUnit` / `createUnitSingle` definition. */
109
- export interface CreateUnitDefObject {
110
- definition?: string | UnitInstance;
111
- prefixes?: string;
112
- offset?: number;
113
- baseName?: string;
114
- aliases?: string[];
115
- }
116
- /** Config object the Unit factory reads (`config` dep + `on('config')`). */
117
- export interface UnitConfig {
118
- number: string;
119
- predictable?: boolean;
120
- }
121
- /** Constructor (with static `.I`) for Complex values. */
122
- export interface ComplexConstructor {
123
- readonly I: ComplexValue;
124
- }
125
- /** Constructor for BigNumber values. */
126
- export interface BigNumberConstructor {
127
- new (value: number | string): BigNumberValue;
128
- }
129
- /** Constructor for Fraction values. */
130
- export interface FractionConstructor {
131
- new (value: Numeric | string, denominator?: number): FractionValue;
132
- }
133
- /** `subtractScalar` is polymorphic: it also subtracts two Units (in splitUnit). */
134
- export interface SubtractScalar {
135
- (a: UnitInstance, b: UnitInstance): UnitInstance;
136
- (a: Numeric, b: Numeric): Numeric;
137
- }
138
- /** A binary scalar operation (add/multiply/divide/pow). */
139
- export type ScalarBinaryOp = (a: Numeric, b: Numeric) => Numeric;
140
- /** A unary scalar operation (abs/fix/round). */
141
- export type ScalarUnaryOp = (x: Numeric) => Numeric;
142
- /**
143
- * The dependency object injected into the Unit factory by the factory system.
144
- * `on` is optional (`?on` in the dependency list).
145
- */
146
- export interface UnitDependencies {
147
- on?: (event: string, callback: (curr: UnitConfig, prev: UnitConfig) => void) => void;
148
- config: UnitConfig;
149
- addScalar: ScalarBinaryOp;
150
- subtractScalar: SubtractScalar;
151
- multiplyScalar: ScalarBinaryOp;
152
- divideScalar: ScalarBinaryOp;
153
- pow: ScalarBinaryOp;
154
- abs: ScalarUnaryOp;
155
- fix: ScalarUnaryOp;
156
- round: ScalarUnaryOp;
157
- equal: (a: unknown, b: unknown) => boolean;
158
- isNumeric: (x: unknown) => boolean;
159
- format: (value: unknown, options?: unknown) => string;
160
- number: (x: unknown) => number;
161
- Complex: ComplexConstructor;
162
- BigNumber: BigNumberConstructor;
163
- Fraction: FractionConstructor;
164
- }
165
- /** An instance of Unit (the prototype methods + per-instance fields). */
166
- export interface UnitInstance {
167
- value: Numeric | null;
168
- units: UnitComponent[];
169
- dimensions: number[];
170
- fixPrefix: boolean;
171
- skipAutomaticSimplification: boolean;
172
- type: 'Unit';
173
- isUnit: boolean;
174
- constructor: UnitConstructor;
175
- clone(): UnitInstance;
176
- valueType(): string;
177
- _isDerived(): boolean;
178
- _normalize(value: Numeric | null | undefined): Numeric | null;
179
- _denormalize(value: Numeric | null, prefixValue?: Numeric): Numeric | null;
180
- hasBase(base: BaseUnitDef | string | undefined): boolean;
181
- equalBase(other: {
182
- dimensions: number[];
183
- }): boolean;
184
- equals(other: UnitInstance): boolean;
185
- multiply(other: UnitInstance | Numeric): UnitInstance | Numeric;
186
- divideInto(numerator: Numeric): UnitInstance | Numeric;
187
- divide(other: UnitInstance | Numeric): UnitInstance | Numeric;
188
- pow(p: number): UnitInstance | Numeric;
189
- abs(): UnitInstance;
190
- to(valuelessUnit: string | UnitInstance): UnitInstance;
191
- toNumber(valuelessUnit?: string | UnitInstance): number;
192
- toNumeric(valuelessUnit?: string | UnitInstance): Numeric | null;
193
- toString(): string;
194
- toJSON(): UnitJSON;
195
- valueOf(): string;
196
- simplify(): UnitInstance;
197
- toSI(): UnitInstance;
198
- formatUnits(): string;
199
- toBest(unitList?: Array<string | UnitInstance>, options?: UnitFormatOptions): UnitInstance;
200
- format(options?: UnitFormatOptions): string;
201
- _bestPrefix(offset?: number): PrefixDef;
202
- splitUnit(parts: Array<string | UnitInstance>): UnitInstance[];
203
- _numberConverter(): ConverterFn;
204
- }
205
- /** The Unit constructor function together with its static members. */
206
- export interface UnitConstructor {
207
- new (value?: Numeric | null, valuelessUnit?: string | UnitInstance): UnitInstance;
208
- prototype: UnitInstance;
209
- name: string;
210
- parse(str: string, options?: ParseOptions): UnitInstance;
211
- isValuelessUnit(name: string): boolean;
212
- isValidAlpha(c: string): boolean;
213
- fromJSON(json: UnitJSON): UnitInstance;
214
- setUnitSystem(name: string): void;
215
- getUnitSystem(): string | undefined;
216
- createUnit(obj: Record<string, unknown>, options?: CreateUnitOptions): UnitInstance | undefined;
217
- createUnitSingle(name: string, obj?: unknown): UnitInstance;
218
- deleteUnit(name: string): void;
219
- _getNumberConverter(type: string): ConverterFn;
220
- typeConverters: TypeConverters;
221
- PREFIXES: Record<string, PrefixTable>;
222
- BASE_DIMENSIONS: string[];
223
- BASE_UNITS: Record<string, BaseUnitDef>;
224
- UNIT_SYSTEMS: Record<string, UnitSystem>;
225
- UNITS: Record<string, UnitDef>;
226
- }
227
- //# sourceMappingURL=unit-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unit-types.d.ts","sourceRoot":"","sources":["../../../src/type/unit/unit-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;AAEnC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;IAC7D,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;CAChE;AAED,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC;AAEhG,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,M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C,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC5D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAE/C,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Calculate BigNumber e
3
- * @param {function} BigNumber BigNumber constructor
4
- * @returns {BigNumber} Returns e
5
- */
6
- export declare const createBigNumberE: import("../function.js").MemoizedFunction;
7
- /**
8
- * Calculate BigNumber golden ratio, phi = (1+sqrt(5))/2
9
- * @param {function} BigNumber BigNumber constructor
10
- * @returns {BigNumber} Returns phi
11
- */
12
- export declare const createBigNumberPhi: import("../function.js").MemoizedFunction;
13
- /**
14
- * Calculate BigNumber pi.
15
- * @param {function} BigNumber BigNumber constructor
16
- * @returns {BigNumber} Returns pi
17
- */
18
- export declare const createBigNumberPi: import("../function.js").MemoizedFunction;
19
- /**
20
- * Calculate BigNumber tau, tau = 2 * pi
21
- * @param {function} BigNumber BigNumber constructor
22
- * @returns {BigNumber} Returns tau
23
- */
24
- export declare const createBigNumberTau: import("../function.js").MemoizedFunction;
25
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/bignumber/constants.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,2CAEf,CAAC;AAEf;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,2CAGjB,CAAC;AAEf;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,2CAEhB,CAAC;AAEf;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,2CAEjB,CAAC"}
@@ -1,53 +0,0 @@
1
- import { lruQueue } from './lruQueue.js';
2
- /**
3
- * Memoize a given function by caching the computed result.
4
- * The cache of a memoized function can be cleared by deleting the `cache`
5
- * property of the function.
6
- *
7
- * @param {function} fn The function to be memoized.
8
- * Must be a pure function.
9
- * @param {Object} [options]
10
- * @param {function(args: Array): string} [options.hasher]
11
- * A custom hash builder. Is JSON.stringify by default.
12
- * @param {number | undefined} [options.limit]
13
- * Maximum number of values that may be cached. Undefined indicates
14
- * unlimited (default)
15
- * @return {function} Returns the memoized function
16
- */
17
- export interface MemoizeCache {
18
- values: Map<string, unknown>;
19
- lru: ReturnType<typeof lruQueue>;
20
- }
21
- export interface MemoizedFunction {
22
- (...args: unknown[]): unknown;
23
- cache?: MemoizeCache;
24
- }
25
- export declare function memoize(fn: (...args: unknown[]) => unknown, { hasher, limit, }?: {
26
- hasher?: (args: unknown[]) => string;
27
- limit?: number;
28
- }): MemoizedFunction;
29
- /**
30
- * Memoize a given function by caching all results and the arguments,
31
- * and comparing against the arguments of previous results before
32
- * executing again.
33
- * This is less performant than `memoize` which calculates a hash,
34
- * which is very fast to compare. Use `memoizeCompare` only when it is
35
- * not possible to create a unique serializable hash from the function
36
- * arguments.
37
- * The isEqual function must compare two sets of arguments
38
- * and return true when equal (can be a deep equality check for example).
39
- * @param {function} fn
40
- * @param {function(a: *, b: *) : boolean} isEqual
41
- * @returns {function}
42
- */
43
- interface CompareCacheEntry {
44
- args: unknown[];
45
- res: unknown;
46
- }
47
- interface MemoizeCompareFunction {
48
- (...args: unknown[]): unknown;
49
- cache: CompareCacheEntry[];
50
- }
51
- export declare function memoizeCompare(fn: (...args: unknown[]) => unknown, isEqual: (a: unknown[], b: unknown[]) => boolean): MemoizeCompareFunction;
52
- export {};
53
- //# sourceMappingURL=function.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/utils/function.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,GAAG,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,OAAO,CACrB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACnC,EACE,MAAM,EACN,KAAK,GACN,GAAE;IAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/D,gBAAgB,CA6BlB;AAED;;;;;;;;;;;;;GAaG;AACH,UAAU,iBAAiB;IACzB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd;AAED,UAAU,sBAAsB;IAC9B,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC9B,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAC5B,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACnC,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,GAC/C,sBAAsB,CAqBxB"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Log a console.warn message only once
3
- */
4
- export declare const warnOnce: (...args: unknown[]) => void;
5
- //# sourceMappingURL=log.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,QAAQ,YAGe,OAAO,EAAE,KAAG,IAS5C,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare function lruQueue(limit: number): {
2
- hit: (id: string) => string | undefined;
3
- delete: (id: string) => void;
4
- clear: () => void;
5
- };
6
- //# sourceMappingURL=lruQueue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lruQueue.d.ts","sourceRoot":"","sources":["../../src/utils/lruQueue.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;cAwBf,MAAM,KAAG,MAAM,GAAG,SAAS;iBAlBtB,MAAM;;EA6CjC"}