@danielsimonjr/mathts-evaluator 0.1.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.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @danielsimonjr/mathts-evaluator
2
+
3
+ Standalone compiler + evaluator for [MathTS](https://github.com/danielsimonjr/mathts) expressions.
4
+
5
+ A focused entry point over the evaluation half of
6
+ [`@danielsimonjr/mathts-expression`](https://www.npmjs.com/package/@danielsimonjr/mathts-expression).
7
+ The implementation is re-exported, not duplicated. Completes the
8
+ `parse -> compile -> evaluate` pipeline alongside
9
+ [`@danielsimonjr/mathts-parser`](https://www.npmjs.com/package/@danielsimonjr/mathts-parser).
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @danielsimonjr/mathts-evaluator
15
+ ```
16
+
17
+ ## What it exports
18
+
19
+ - `compile` -- compile a parsed AST node against a math scope into an executable form.
20
+ - `createEvaluate` -- build an `evaluate(expr, scope?)` function from a `parse` function + math scope.
21
+ - `compileExpression` -- compile an expression string directly.
22
+ - Types: `CompiledExpression`, `Scope`.
23
+
24
+ ```ts
25
+ import { createEvaluate } from '@danielsimonjr/mathts-evaluator';
26
+ import { createParse } from '@danielsimonjr/mathts-parser';
27
+ // wire createParse into your math scope, then:
28
+ // const evaluate = createEvaluate(parse, mathScope);
29
+ // evaluate('2 + 3'); // 5
30
+ ```
31
+
32
+ ## License
33
+
34
+ MIT (c) Daniel Simon Jr.
@@ -0,0 +1 @@
1
+ export { CompiledExpression, Scope, compile, compileExpression, createEvaluate } from '@danielsimonjr/mathts-expression';
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // src/index.ts
2
+ import {
3
+ compile,
4
+ createEvaluate,
5
+ compileExpression
6
+ } from "@danielsimonjr/mathts-expression";
7
+ export {
8
+ compile,
9
+ compileExpression,
10
+ createEvaluate
11
+ };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@danielsimonjr/mathts-evaluator",
3
+ "version": "0.1.0",
4
+ "description": "Standalone compiler + evaluator for MathTS expressions, re-exported as a focused package",
5
+ "author": "Daniel Simon Jr.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsup src/index.ts --format esm --dts --clean",
23
+ "dev": "tsup src/index.ts --format esm --dts --watch",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "test:coverage": "vitest run --coverage",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint src --ext .ts",
29
+ "lint:fix": "eslint src --ext .ts --fix",
30
+ "clean": "rm -rf dist",
31
+ "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
32
+ },
33
+ "dependencies": {
34
+ "@danielsimonjr/mathts-core": "0.1.3",
35
+ "@danielsimonjr/mathts-expression": "0.2.2",
36
+ "typed-function": "^4.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^25.5.2",
40
+ "tsup": "^8.0.0",
41
+ "typescript": "^5.3.0",
42
+ "vitest": "^4.1.5"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/danielsimonjr/mathts",
50
+ "directory": "evaluator"
51
+ },
52
+ "keywords": [
53
+ "math",
54
+ "typescript",
55
+ "evaluator",
56
+ "compiler",
57
+ "expression",
58
+ "evaluate",
59
+ "compile"
60
+ ]
61
+ }