parse-boolean

functionsince v1.11.50Edit
(parse-boolean s)

Source docstring:
Parse strings "true" or "false" and return a boolean, or nil if invalid. Note that this explicitly
excludes strings with different cases, or space characters.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn parse-boolean
  [s]
  (if (string? s)
    (case s
      "true" true
      "false" false
      nil)
    (throw (js/Error. (parsing-err s)))))