Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2430 - scientific notation support #2488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/lib/isNumeric.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assertString from './util/assertString';
import { decimal } from './alpha';
import assertString from "./util/assertString";

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Strings must use singlequote

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Strings must use singlequote

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Strings must use singlequote

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Strings must use singlequote

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Strings must use singlequote

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Strings must use singlequote

Check failure on line 1 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Strings must use singlequote
import { decimal } from "./alpha";

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Strings must use singlequote

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Strings must use singlequote

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Strings must use singlequote

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Strings must use singlequote

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Strings must use singlequote

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Strings must use singlequote

Check failure on line 2 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Strings must use singlequote

const numericNoSymbols = /^[0-9]+$/;

Expand All @@ -8,5 +8,10 @@
if (options && options.no_symbols) {
return numericNoSymbols.test(str);
}
return (new RegExp(`^[+-]?([0-9]*[${(options || {}).locale ? decimal[options.locale] : '.'}])?[0-9]+$`)).test(str);

const decimalSymbol = (options || {}).locale ? decimal[options.locale] : ".";

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Strings must use singlequote

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Strings must use singlequote

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Strings must use singlequote

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Strings must use singlequote

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Strings must use singlequote

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Strings must use singlequote

Check failure on line 12 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Strings must use singlequote

return new RegExp(

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Unexpected newline after '('

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Unexpected newline after '('

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Unexpected newline after '('

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Unexpected newline after '('

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Unexpected newline after '('

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Unexpected newline after '('

Check failure on line 14 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Unexpected newline after '('
`^[+-]?(?:\\d+|\\d*${decimalSymbol}\\d+)(?:[eE][+-]?\\d+)?$`
).test(str);

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Unexpected newline before ')'

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Unexpected newline before ')'

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Unexpected newline before ')'

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Unexpected newline before ')'

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Unexpected newline before ')'

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Unexpected newline before ')'

Check failure on line 16 in src/lib/isNumeric.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Unexpected newline before ')'
}
Loading