From a6a78f160e996d837a17896562af1017eb6fde25 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Jul 2025 14:45:07 -0300 Subject: src/sjs.mjs: Add isNumeric() --- tests/sjs.mjs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/sjs.mjs') 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, -- cgit v1.2.3