nv-constexpr-angle-exec 1.0.2 → 1.0.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/TEST/tst.js +2 -1
- package/index.js +9 -3
- package/package.json +2 -2
package/TEST/tst.js
CHANGED
|
@@ -17,7 +17,8 @@ const basicEnv = {
|
|
|
17
17
|
|
|
18
18
|
const [ok1, result1] = run(basicEnv, `({ bigint, num, str, bool, nil, undef})`);
|
|
19
19
|
console.log("Result:", ok1, result1);
|
|
20
|
-
console.log(run(basicEnv, `
|
|
20
|
+
console.log(run(basicEnv, `new String("aaa")`, false));
|
|
21
|
+
console.log(run(basicEnv, `new Uint8Array([1,2,3])`, false));
|
|
21
22
|
|
|
22
23
|
// ============ 测试 2: TypedArrays ============
|
|
23
24
|
console.log("测试 2: TypedArrays");
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ class AngleExec {
|
|
|
15
15
|
var [cond,reason] = codify.is_supported(r,true);
|
|
16
16
|
if(cond) {
|
|
17
17
|
if(typeof(keep_cmt) === "function") {
|
|
18
|
-
keep_cmt = keep_cmt();
|
|
18
|
+
keep_cmt = keep_cmt(r);
|
|
19
19
|
} else {}
|
|
20
20
|
if(keep_cmt) {
|
|
21
21
|
return [true, codify(r)+`/*${code}*/`]
|
|
@@ -29,9 +29,15 @@ class AngleExec {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const creat = (env) => new AngleExec(env)
|
|
32
|
-
const run = (env,code,keep_cmt=
|
|
32
|
+
const run = (env,code,keep_cmt=(r)=>{
|
|
33
|
+
if(r?.constructor?.name === "String") {
|
|
34
|
+
return false;
|
|
35
|
+
} else {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
})=>{
|
|
33
39
|
var ctx = creat(env);
|
|
34
|
-
return ctx.run(code);
|
|
40
|
+
return ctx.run(code,keep_cmt);
|
|
35
41
|
}
|
|
36
42
|
module.exports = run;
|
|
37
43
|
module.exports.creat = creat;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nv-constexpr-angle-exec",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"description": "",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"nv-constexpr-simple-codify": "^1.0.
|
|
12
|
+
"nv-constexpr-simple-codify": "^1.0.7"
|
|
13
13
|
}
|
|
14
14
|
}
|