diff options
| author | EuAndreh <eu@euandre.org> | 2025-07-11 14:45:07 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2025-07-11 14:45:07 -0300 |
| commit | a6a78f160e996d837a17896562af1017eb6fde25 (patch) | |
| tree | 8a69cdcca72c250115064353fc6937dc9a704cf2 /tests/sjs.mjs | |
| parent | Use .mjs extension; add reduce(); finish tests; export names correctly. (diff) | |
| download | sjs-a6a78f160e996d837a17896562af1017eb6fde25.tar.gz sjs-a6a78f160e996d837a17896562af1017eb6fde25.tar.xz | |
src/sjs.mjs: Add isNumeric()
Diffstat (limited to '')
| -rw-r--r-- | tests/sjs.mjs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/sjs.mjs b/tests/sjs.mjs index dbcd635..c8f52dd 100644 --- a/tests/sjs.mjs +++ b/tests/sjs.mjs @@ -1,6 +1,7 @@ import { max, min, + isNumeric, explode, getIn, merge, @@ -58,6 +59,19 @@ const test_min = t => { }); }; +const test_isNumeric = t => { + t.start("isNumeric()"); + + t.testing("checks if (first) char is numeric", () => { + t.assertEq(isNumeric("0"), true); + t.assertEq(isNumeric("5"), true); + t.assertEq(isNumeric("9"), true); + t.assertEq(isNumeric("10"), true); + t.assertEq(isNumeric("1a"), true); + t.assertEq(isNumeric("a1"), false); + }); +}; + const test_explode = t => { t.start("explode()"); @@ -976,6 +990,7 @@ const test_repeat = t => { runTests([ test_max, test_min, + test_isNumeric, test_explode, test_getIn, test_merge, |
