util-helpers 4.19.0 → 4.19.1
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/dist/util-helpers.js +65 -10
- package/dist/util-helpers.js.map +1 -1
- package/dist/util-helpers.min.js +1 -1
- package/dist/util-helpers.min.js.map +1 -1
- package/esm/VERSION.js +1 -1
- package/esm/index.js +1 -1
- package/esm/round.js +4 -12
- package/lib/VERSION.js +1 -1
- package/lib/index.js +1 -1
- package/lib/round.js +3 -11
- package/package.json +2 -2
- package/types/round.d.ts +2 -2
package/esm/VERSION.js
CHANGED
package/esm/index.js
CHANGED
package/esm/round.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import divide from './divide.js';
|
|
3
|
-
import times from './times.js';
|
|
4
|
-
import { transformEffectiveNumber } from './utils/math.util.js';
|
|
1
|
+
import { round } from 'ut2';
|
|
5
2
|
|
|
6
|
-
function
|
|
3
|
+
function _round(num, precision) {
|
|
7
4
|
if (precision === void 0) { precision = 0; }
|
|
8
|
-
|
|
9
|
-
if (isNaN(num)) {
|
|
10
|
-
return Number.NaN;
|
|
11
|
-
}
|
|
12
|
-
var base = Math.pow(10, precision);
|
|
13
|
-
return divide(Math.round(times(num, base)), base);
|
|
5
|
+
return round(num, precision);
|
|
14
6
|
}
|
|
15
7
|
|
|
16
|
-
export {
|
|
8
|
+
export { _round as default };
|
package/lib/VERSION.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -59,7 +59,7 @@ var findTreeSelect = require('./findTreeSelect.js');
|
|
|
59
59
|
var config = require('./utils/config.js');
|
|
60
60
|
var VERSION = require('./VERSION.js');
|
|
61
61
|
|
|
62
|
-
exports.version = "4.19.
|
|
62
|
+
exports.version = "4.19.1";
|
|
63
63
|
|
|
64
64
|
exports.isMobile = isMobile;
|
|
65
65
|
exports.isTelephone = isTelephone;
|
package/lib/round.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ut2 = require('ut2');
|
|
4
|
-
var divide = require('./divide.js');
|
|
5
|
-
var times = require('./times.js');
|
|
6
|
-
var math_util = require('./utils/math.util.js');
|
|
7
4
|
|
|
8
|
-
function
|
|
5
|
+
function _round(num, precision) {
|
|
9
6
|
if (precision === void 0) { precision = 0; }
|
|
10
|
-
|
|
11
|
-
if (ut2.isNaN(num)) {
|
|
12
|
-
return Number.NaN;
|
|
13
|
-
}
|
|
14
|
-
var base = Math.pow(10, precision);
|
|
15
|
-
return divide(Math.round(times(num, base)), base);
|
|
7
|
+
return ut2.round(num, precision);
|
|
16
8
|
}
|
|
17
9
|
|
|
18
|
-
module.exports =
|
|
10
|
+
module.exports = _round;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "util-helpers",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.1",
|
|
4
4
|
"description": "一个基于业务场景的工具方法库",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -93,6 +93,6 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"tslib": "^2.5.0",
|
|
96
|
-
"ut2": "^1.0.
|
|
96
|
+
"ut2": "^1.0.5"
|
|
97
97
|
}
|
|
98
98
|
}
|
package/types/round.d.ts
CHANGED