strnum 2.1.0 → 2.1.2
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/.github/SECURITY.md +5 -0
- package/CHANGELOG.md +3 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/strnum.js +2 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
If you believe you have found a security vulnerability in this repository which can be potentially harful for the users in anyway, please do not report security vulnerabilities through public GitHub issues. Instead, please report it to us as described below.
|
|
2
|
+
|
|
3
|
+
## Security contact information
|
|
4
|
+
|
|
5
|
+
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -95,3 +95,9 @@ leadingZeros: true, //when number with leading zeros like 08 should be parsed. 0
|
|
|
95
95
|
eNotation: true, //when number with eNotation or number parsed in eNotation should be considered
|
|
96
96
|
skipLike: /regex/ //when string should not be parsed when it matches the specified regular expression
|
|
97
97
|
```
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# Try out our other work
|
|
101
|
+
|
|
102
|
+
WishIn - You need it if negative thoughts take over all the time <br>
|
|
103
|
+
<a href="https://play.google.com/store/apps/details?id=com.solothought.wishin"> <img src="https://solothought.com/products/assets/images/wishin/YouTubeThumbnail.png" width="500px"/> </a>
|
package/package.json
CHANGED
package/strnum.js
CHANGED
|
@@ -25,7 +25,7 @@ export default function toNumber(str, options = {}){
|
|
|
25
25
|
return parse_int(trimmedStr, 16);
|
|
26
26
|
// }else if (options.oct && octRegex.test(str)) {
|
|
27
27
|
// return Number.parseInt(val, 8);
|
|
28
|
-
}else if (trimmedStr.
|
|
28
|
+
}else if (trimmedStr.includes('e') || trimmedStr.includes('E')) { //eNotation
|
|
29
29
|
return resolveEnotation(str,trimmedStr,options);
|
|
30
30
|
// }else if (options.parseBin && binRegex.test(str)) {
|
|
31
31
|
// return Number.parseInt(val, 2);
|
|
@@ -52,7 +52,7 @@ export default function toNumber(str, options = {}){
|
|
|
52
52
|
const num = Number(trimmedStr);
|
|
53
53
|
const parsedStr = String(num);
|
|
54
54
|
|
|
55
|
-
if( num === 0
|
|
55
|
+
if( num === 0) return num;
|
|
56
56
|
if(parsedStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
|
|
57
57
|
if(options.eNotation) return num;
|
|
58
58
|
else return str;
|