diff lib/js/urweb.js @ 2097:9272476e2a1c

Client-side conversion of string to bool
author Adam Chlipala <adam@chlipala.net>
date Thu, 25 Dec 2014 18:32:27 -0500
parents f05fcb206571
children 9e9c915f554c
line wrap: on
line diff
--- a/lib/js/urweb.js	Wed Dec 24 12:35:20 2014 -0500
+++ b/lib/js/urweb.js	Thu Dec 25 18:32:27 2014 -0500
@@ -1261,6 +1261,8 @@
 
 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); }