From 0562a6b4d4c94d571abfcd407c98ed259a99bd7e Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 25 Dec 2014 18:32:27 -0500 Subject: Client-side conversion of string to bool --- lib/js/urweb.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/js') 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); } -- cgit v1.2.3