summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2014-12-25 18:32:27 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2014-12-25 18:32:27 -0500
commit0562a6b4d4c94d571abfcd407c98ed259a99bd7e (patch)
treea068344107f7d2283ce7c3aabe8469baacc2f930
parent80e5288d76eaf9fa4ac264e34fd1299d8e4c0642 (diff)
Client-side conversion of string to bool
-rw-r--r--lib/js/urweb.js2
-rw-r--r--src/settings.sml2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 342dc943..df9097b1 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1261,6 +1261,8 @@ function eh(x) {
function ts(x) { return x.toString() }
function bs(b) { return (b ? "True" : "False") }
+function s2b(s) { return s == "True" ? true : s == "False" ? false : null; }
+function s2be(s) { return s == "True" ? true : s == "False" ? false : er("Illegal Boolean " ^ s); }
function id(x) { return x; }
function sub(s, i) { return s.charAt(i); }
diff --git a/src/settings.sml b/src/settings.sml
index fafb38c5..343ea358 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -297,6 +297,8 @@ val jsFuncsBase = basisM [("alert", "alert"),
("mouseEvent", "uw_mouseEvent"),
("keyEvent", "uw_keyEvent"),
("minTime", "0"),
+ ("stringToBool_error", "s2be"),
+ ("stringToBool", "s2b"),
("islower", "isLower"),
("isupper", "isUpper"),