We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12b27a2 commit e6fbe15Copy full SHA for e6fbe15
src/lib/isNumeric.js
@@ -1,5 +1,5 @@
1
-import assertString from './util/assertString';
2
-import { decimal } from './alpha';
+import assertString from "./util/assertString";
+import { decimal } from "./alpha";
3
4
const numericNoSymbols = /^[0-9]+$/;
5
@@ -8,5 +8,10 @@ export default function isNumeric(str, options) {
8
if (options && options.no_symbols) {
9
return numericNoSymbols.test(str);
10
}
11
- return (new RegExp(`^[+-]?([0-9]*[${(options || {}).locale ? decimal[options.locale] : '.'}])?[0-9]+$`)).test(str);
+
12
+ const decimalSymbol = (options || {}).locale ? decimal[options.locale] : ".";
13
14
+ return new RegExp(
15
+ `^[+-]?(?:\\d+|\\d*${decimalSymbol}\\d+)(?:[eE][+-]?\\d+)?$`
16
+ ).test(str);
17
0 commit comments