@tachybase/evaluators 1.3.19 → 1.3.21
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/lib/client/index.js
CHANGED
|
@@ -35,10 +35,8 @@ __export(client_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(client_exports);
|
|
36
36
|
var import_client = require("@tachybase/utils/client");
|
|
37
37
|
var import_formulajs = __toESM(require("./engines/formulajs"));
|
|
38
|
-
var import_mathjs = __toESM(require("./engines/mathjs"));
|
|
39
38
|
var import_string = __toESM(require("./engines/string"));
|
|
40
39
|
const evaluators = new import_client.Registry();
|
|
41
|
-
evaluators.register("math.js", import_mathjs.default);
|
|
42
40
|
evaluators.register("formula.js", import_formulajs.default);
|
|
43
41
|
evaluators.register("string", import_string.default);
|
|
44
42
|
function getOptions() {
|
package/lib/server/index.js
CHANGED
|
@@ -35,11 +35,9 @@ __export(server_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(server_exports);
|
|
36
36
|
var import_utils = require("@tachybase/utils");
|
|
37
37
|
var import_formulajs = __toESM(require("../utils/formulajs"));
|
|
38
|
-
var import_mathjs = __toESM(require("../utils/mathjs"));
|
|
39
38
|
var import_string = __toESM(require("../utils/string"));
|
|
40
39
|
var import_utils3 = require("../utils");
|
|
41
40
|
const evaluators = new import_utils.Registry();
|
|
42
|
-
evaluators.register("math.js", import_mathjs.default);
|
|
43
41
|
evaluators.register("formula.js", import_formulajs.default);
|
|
44
42
|
evaluators.register("string", import_string.default);
|
|
45
43
|
var server_default = evaluators;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/evaluators",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
@@ -28,10 +28,9 @@
|
|
|
28
28
|
"main": "./lib/index.js",
|
|
29
29
|
"types": "./lib/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@formulajs/formulajs": "4.
|
|
31
|
+
"@formulajs/formulajs": "4.5.3",
|
|
32
32
|
"lodash": "4.17.21",
|
|
33
|
-
"
|
|
34
|
-
"@tachybase/utils": "1.3.19"
|
|
33
|
+
"@tachybase/utils": "1.3.21"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
36
|
"@types/node": "20.17.10"
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var mathjs_exports = {};
|
|
29
|
-
__export(mathjs_exports, {
|
|
30
|
-
default: () => mathjs_default
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(mathjs_exports);
|
|
33
|
-
var import_mathjs = __toESM(require("../../utils/mathjs"));
|
|
34
|
-
var mathjs_default = {
|
|
35
|
-
label: "Math.js",
|
|
36
|
-
tooltip: `{{t('Math.js comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types.')}}`,
|
|
37
|
-
link: "https://mathjs.org/",
|
|
38
|
-
evaluate: import_mathjs.default
|
|
39
|
-
};
|
package/lib/utils/mathjs.d.ts
DELETED
package/lib/utils/mathjs.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var mathjs_exports = {};
|
|
29
|
-
__export(mathjs_exports, {
|
|
30
|
-
default: () => mathjs_default
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(mathjs_exports);
|
|
33
|
-
var math = __toESM(require("mathjs"));
|
|
34
|
-
var import__ = require(".");
|
|
35
|
-
var mathjs_default = import__.evaluate.bind(
|
|
36
|
-
function(expression, scope = {}) {
|
|
37
|
-
const result = math.evaluate(expression, scope);
|
|
38
|
-
if (typeof result === "number") {
|
|
39
|
-
if (Number.isNaN(result) || !Number.isFinite(result)) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
return math.round(result, 9);
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
},
|
|
46
|
-
{ replaceKey: true }
|
|
47
|
-
);
|