strnum 1.1.0 → 2.0.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
1
 
2
+ **2.0.0 / 2025-02-20**
3
+ - Migrating to ESM modules. No functional change
4
+
2
5
  **1.1.0 / 2025-02-20**
3
6
  - fix (#9): support missing floating point and e notations
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "strnum",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Parse String to Number based on configuration",
5
+ "type": "module",
5
6
  "main": "strnum.js",
6
7
  "scripts": {
7
8
  "test": "jasmine strnum.test.js"
@@ -19,6 +20,6 @@
19
20
  "author": "Amit Gupta (https://amitkumargupta.work/)",
20
21
  "license": "MIT",
21
22
  "devDependencies": {
22
- "jasmine": "^3.10.0"
23
+ "jasmine": "^5.6.0"
23
24
  }
24
25
  }
package/strnum.js CHANGED
@@ -13,7 +13,7 @@ const consider = {
13
13
  //skipLike: /regex/
14
14
  };
15
15
 
16
- function toNumber(str, options = {}){
16
+ export default function toNumber(str, options = {}){
17
17
  options = Object.assign({}, consider, options );
18
18
  if(!str || typeof str !== "string" ) return str;
19
19
 
@@ -103,4 +103,3 @@ function parse_int(numStr, base){
103
103
  else if(window && window.parseInt) return window.parseInt(numStr, base);
104
104
  else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")
105
105
  }
106
- module.exports = toNumber
package/strnum.test.js CHANGED
@@ -1,4 +1,4 @@
1
- const toNumber = require("./strnum");
1
+ import toNumber from "./strnum.js";
2
2
 
3
3
  describe("Should convert all the valid numeric strings to number", () => {
4
4
  it("should return undefined, null, empty string, or non-numeric as it is", () => {
package/test.js DELETED
@@ -1,6 +0,0 @@
1
- const toNumber = require("./strnum");
2
-
3
- // console.log(toNumber("01.0e2"))
4
- console.log(toNumber("-06"))
5
- // console.log(toNumber("+01.0e2"))
6
- // console.log(toNumber("+001.0e2"))