sh-tools 2.3.5 → 2.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sh-tools",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "基于fetch和xe-utils二次封装,支持宏公式计算",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "author": "神秘的sh",
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
- "expr-eval": "^2.0.2",
15
+ "hot-formula-parser": "^4.0.0",
16
16
  "xe-utils": "^3.8.2"
17
17
  },
18
18
  "devDependencies": {
package/packages/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import http from './api'
2
2
  import utils from './utils'
3
- import expr from './expr'
3
+ import parser from './parser'
4
4
 
5
- export { http, utils, expr }
5
+ export { http, utils, parser }
@@ -0,0 +1,4 @@
1
+ import { Parser } from 'hot-formula-parser'
2
+ const formulaParser = new Parser()
3
+
4
+ export default formulaParser
@@ -1,6 +1,6 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import stringUtil from './string'
3
- import expParser from '../expr'
3
+ import formulaParser from '../parser'
4
4
 
5
5
  export default {
6
6
  truncate(num, digits) {
@@ -17,7 +17,7 @@ export default {
17
17
  if (data && XEUtils.isPlainObject(data)) {
18
18
  formula = stringUtil.format(formula, data, true)
19
19
  }
20
- const expr = expParser.parse(formula)
21
- return expr.evaluate(data)
20
+ let { result } = formulaParser.parse(formula)
21
+ return result
22
22
  }
23
23
  }
@@ -1,5 +0,0 @@
1
- import { Parser } from 'expr-eval'
2
-
3
- const parser = new Parser()
4
-
5
- export default parser