@danielsimonjr/mathts-compat 0.1.2 → 0.1.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/dist/index.d.ts +13 -4
- package/dist/index.js +6 -3
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -232,6 +232,13 @@ interface MathJSConfig {
|
|
|
232
232
|
* MathTS instance with mathjs-compatible API
|
|
233
233
|
*/
|
|
234
234
|
interface MathInstance {
|
|
235
|
+
/**
|
|
236
|
+
* Index signature for the full functions namespace surfaced by
|
|
237
|
+
* `create(all)`. Members declared explicitly below keep their precise
|
|
238
|
+
* types; everything else (det, integrate, eigs, …) is reachable as
|
|
239
|
+
* `unknown` and can be narrowed by the caller.
|
|
240
|
+
*/
|
|
241
|
+
[name: string]: unknown;
|
|
235
242
|
config: (newConfig?: Partial<MathJSConfig>) => MathJSConfig;
|
|
236
243
|
complex: typeof shims.complex;
|
|
237
244
|
fraction: typeof shims.fraction;
|
|
@@ -295,7 +302,8 @@ interface MathInstance {
|
|
|
295
302
|
/**
|
|
296
303
|
* Create a MathTS instance with mathjs-compatible API
|
|
297
304
|
*
|
|
298
|
-
* @param
|
|
305
|
+
* @param factories - Factory functions to include (use `all` for the full
|
|
306
|
+
* `@danielsimonjr/mathts-functions` surface; defaults to `all`)
|
|
299
307
|
* @param config - Configuration options
|
|
300
308
|
* @returns MathTS instance with mathjs-compatible API
|
|
301
309
|
*
|
|
@@ -304,12 +312,13 @@ interface MathInstance {
|
|
|
304
312
|
* import { create, all } from '@danielsimonjr/mathts-compat';
|
|
305
313
|
* const math = create(all);
|
|
306
314
|
*
|
|
307
|
-
* math.add(1, 2);
|
|
308
|
-
* math.complex(3, 4);
|
|
315
|
+
* math.add(1, 2); // 3
|
|
316
|
+
* math.complex(3, 4); // Complex(3, 4)
|
|
309
317
|
* math.matrix([[1,2],[3,4]]); // DenseMatrix
|
|
318
|
+
* math.det([[1,2],[3,4]]); // -2 (full functions surface)
|
|
310
319
|
* ```
|
|
311
320
|
*/
|
|
312
|
-
declare function create(
|
|
321
|
+
declare function create(factories?: Record<string, unknown>, config?: Partial<MathJSConfig>): MathInstance;
|
|
313
322
|
/**
|
|
314
323
|
* All available factory functions
|
|
315
324
|
*
|
package/dist/index.js
CHANGED
|
@@ -325,6 +325,7 @@ var shims = {
|
|
|
325
325
|
};
|
|
326
326
|
|
|
327
327
|
// src/index.ts
|
|
328
|
+
import * as mathFunctions from "@danielsimonjr/mathts-functions";
|
|
328
329
|
import {
|
|
329
330
|
Complex as Complex2,
|
|
330
331
|
Fraction as Fraction2,
|
|
@@ -348,9 +349,12 @@ var defaultConfig = {
|
|
|
348
349
|
epsilon: 1e-12,
|
|
349
350
|
randomSeed: null
|
|
350
351
|
};
|
|
351
|
-
function create(
|
|
352
|
+
function create(factories = all, config = {}) {
|
|
352
353
|
const currentConfig = { ...defaultConfig, ...config };
|
|
353
354
|
return {
|
|
355
|
+
// Full @danielsimonjr/mathts-functions namespace — det, integrate, eigs,
|
|
356
|
+
// simplify, and the rest. The compat-specific shims below overlay it.
|
|
357
|
+
...factories,
|
|
354
358
|
// Configuration
|
|
355
359
|
config: (newConfig) => {
|
|
356
360
|
if (newConfig) {
|
|
@@ -429,8 +433,7 @@ function create(_factories = {}, config = {}) {
|
|
|
429
433
|
};
|
|
430
434
|
}
|
|
431
435
|
var all = {
|
|
432
|
-
|
|
433
|
-
// For MathTS compat, we include everything by default in create()
|
|
436
|
+
...mathFunctions
|
|
434
437
|
};
|
|
435
438
|
export {
|
|
436
439
|
BIGNUMBER_E,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-compat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "mathjs compatibility layer for MathTS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@danielsimonjr/mathts-core": "
|
|
27
|
-
"@danielsimonjr/mathts-functions": "
|
|
28
|
-
"@danielsimonjr/mathts-matrix": "
|
|
29
|
-
"@danielsimonjr/mathts-parallel": "
|
|
26
|
+
"@danielsimonjr/mathts-core": "0.1.3",
|
|
27
|
+
"@danielsimonjr/mathts-functions": "0.2.2",
|
|
28
|
+
"@danielsimonjr/mathts-matrix": "0.1.4",
|
|
29
|
+
"@danielsimonjr/mathts-parallel": "0.2.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^25.5.2",
|
|
33
|
-
"tsup": "^8.
|
|
34
|
-
"typescript": "^5.
|
|
35
|
-
"vitest": "^
|
|
33
|
+
"tsup": "^8.0.0",
|
|
34
|
+
"typescript": "^5.3.0",
|
|
35
|
+
"vitest": "^4.1.5"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"math",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"compatibility",
|
|
42
42
|
"migration"
|
|
43
43
|
],
|
|
44
|
-
"author": "",
|
|
44
|
+
"author": "Daniel Simon Jr.",
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
48
|
-
"url": "https://github.com/danielsimonjr/
|
|
48
|
+
"url": "https://github.com/danielsimonjr/mathts",
|
|
49
49
|
"directory": "compat"
|
|
50
50
|
},
|
|
51
51
|
"module": "./dist/index.js",
|