@icgio/icg-utils 1.6.22 → 1.6.24

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.
Files changed (2) hide show
  1. package/lib/utils.js +22 -20
  2. package/package.json +1 -1
package/lib/utils.js CHANGED
@@ -1,26 +1,28 @@
1
1
  const _ = require('lodash')
2
2
 
3
- Number.prototype.toFixed_old = Number.prototype.toFixed
3
+ // Number.prototype.toFixed_old = Number.prototype.toFixed
4
4
 
5
- Number.prototype.toFixed = function(s) {
6
- if (s >= 0 && s <= 20) {
7
- return this.toFixed_old(s)
8
- }
9
- let changenum = (parseInt(this * Math.pow(10, s) + 0.5) / Math.pow(10, s)).toString()
10
- index = changenum.indexOf('.')
11
- if (index < 0 && s > 0) {
12
- changenum = changenum + '.'
13
- for (i = 0; i < s; i++) {
14
- changenum = changenum + '0'
15
- }
16
- } else {
17
- index = changenum.length - index;
18
- for (i = 0; i < (s - index) + 1; i++) {
19
- changenum = changenum + '0'
20
- }
21
- }
22
- return changenum
23
- }
5
+ // Number.prototype.toFixed = function(s) {
6
+ // if (s >= 0 && s <= 20) {
7
+ // return this.toFixed_old(s)
8
+ // }
9
+ // let changenum = (parseInt(this * Math.pow(10, s) + 0.5) / Math.pow(10, s)).toString()
10
+ // index = changenum.indexOf('.')
11
+ // if (index < 0 && s > 0) {
12
+ // changenum = changenum + '.'
13
+ // for (i = 0; i < s; i++) {
14
+ // changenum = changenum + '0'
15
+ // }
16
+ // } else {
17
+ // index = changenum.length - index;
18
+ // for (i = 0; i < (s - index) + 1; i++) {
19
+ // changenum = changenum + '0'
20
+ // }
21
+ // }
22
+ // return changenum
23
+ // }
24
+
25
+ // console.log(0.000000000000000000000000001232312421.toFixed(30))
24
26
 
25
27
  Number.prototype.toStringNoExponents = function() {
26
28
  let data= String(this).split(/[eE]/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.6.22",
3
+ "version": "1.6.24",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {