strnum 2.0.3 → 2.0.4

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,5 +1,8 @@
1
1
 
2
- **2.0.2 / 2025-02-20**
2
+ **2.0.4 / 2025-02-20**
3
+ - remove console log
4
+
5
+ **2.0.3 / 2025-02-20**
3
6
  - fix for string which are falsly identified as e-notation
4
7
 
5
8
  **2.0.1 / 2025-02-20**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strnum",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Parse String to Number based on configuration",
5
5
  "type": "module",
6
6
  "main": "strnum.js",
package/strnum.js CHANGED
@@ -29,7 +29,7 @@ export default function toNumber(str, options = {}){
29
29
  const notation = trimmedStr.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
30
30
  // +00.123 => [ , '+', '00', '.123', ..
31
31
  if(notation){
32
- console.log(notation)
32
+ // console.log(notation)
33
33
  if(options.leadingZeros){ //accept with leading zeros
34
34
  trimmedStr = (notation[1] || "") + notation[3];
35
35
  }else{
package/strnum.test.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import toNumber from "./strnum.js";
2
2
 
3
3
  describe("Should convert all the valid numeric strings to number", () => {
4
- fit("should return undefined, null, empty string, or non-numeric as it is", () => {
5
- // expect(toNumber(undefined)).not.toBeDefined();
6
- // expect(toNumber(null)).toEqual(null);
7
- // expect(toNumber("")).toEqual("");
8
- // expect(toNumber("string")).toEqual("string");
4
+ it("should return undefined, null, empty string, or non-numeric as it is", () => {
5
+ expect(toNumber(undefined)).not.toBeDefined();
6
+ expect(toNumber(null)).toEqual(null);
7
+ expect(toNumber("")).toEqual("");
8
+ expect(toNumber("string")).toEqual("string");
9
9
  expect(toNumber("e89794659669cb7bb967db73a7ea6889c3891727")).toEqual("e89794659669cb7bb967db73a7ea6889c3891727");
10
10
  });
11
11
  it("should not parse number with spaces or comma", () => {