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.
|
|
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
|
-
"
|
|
15
|
+
"hot-formula-parser": "^4.0.0",
|
|
16
16
|
"xe-utils": "^3.8.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/packages/index.js
CHANGED
package/packages/utils/number.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
2
|
import stringUtil from './string'
|
|
3
|
-
import
|
|
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
|
-
|
|
21
|
-
return
|
|
20
|
+
let { result } = formulaParser.parse(formula)
|
|
21
|
+
return result
|
|
22
22
|
}
|
|
23
23
|
}
|