backend v4 half
This commit is contained in:
+9
-1
@@ -1,4 +1,4 @@
|
||||
const toNumber = require("./strnum.js");
|
||||
import toNumber from "./strnum.js";
|
||||
|
||||
describe("Should convert all the valid numeric strings to number", () => {
|
||||
it("should return undefined, null, empty string, or non-numeric as it is", () => {
|
||||
@@ -95,6 +95,7 @@ describe("Should convert all the valid numeric strings to number", () => {
|
||||
expect(toNumber("-.006")).toEqual(-0.006);
|
||||
expect(toNumber("-6.0")).toEqual(-6);
|
||||
expect(toNumber("-06.0")).toEqual(-6);
|
||||
expect(toNumber("+06.0")).toEqual(6);
|
||||
|
||||
expect(toNumber("-0.0" , { leadingZeros : false})).toEqual(-0);
|
||||
expect(toNumber("-00.00", { leadingZeros : false})).toEqual("-00.00");
|
||||
@@ -137,6 +138,13 @@ describe("Should convert all the valid numeric strings to number", () => {
|
||||
|
||||
expect(toNumber("-1.0E2") ).toEqual(-100);
|
||||
expect(toNumber("1.0E-2")).toEqual(0.01);
|
||||
|
||||
expect(toNumber("E-2")).toEqual("E-2");
|
||||
expect(toNumber("E2")).toEqual("E2");
|
||||
expect(toNumber("0E2")).toEqual(0);
|
||||
expect(toNumber("-0E2")).toEqual(-0);
|
||||
expect(toNumber("00E2")).toEqual("00E2");
|
||||
expect(toNumber("00E2", { leadingZeros : false})).toEqual("00E2");
|
||||
});
|
||||
|
||||
it("should skip matching pattern", () => {
|
||||
|
||||
Reference in New Issue
Block a user