2.0.2 • Published 2 years ago

@cstan/only-numeric v2.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

only-numeric

A Common JS package that has a string for the first argument and the second (optional) argument is boolean. If you use a decimal POINT (period) as a decimal marker the second arg should be true (absent second argument defaults to true), if you use a decimal COMMA as a decimal marker the second argument should be false.

Installation:

npm install @cstan/only-numeric

Use:

const { onlyNumeric } = require("@cstan/only-numeric")

let s = "- $USD 1,234.56";
let n = onlyNumeric(s);
console.log(`The number is: ${n}`);
// -1234.56

OR

let s = " EU - 1.234,56";
let n = onlyNumeric(s, false); // Note: false added as second argument
console.log(`The number is: ${n}`);
// -1234,56
2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago