From 9dbe839f074a8ed69f1e2853f7d40c21a9db407f Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Fri, 17 Mar 2017 03:39:38 -0400 Subject: add boolean to option helper --- stage1/cbt.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'stage1/cbt.scala') diff --git a/stage1/cbt.scala b/stage1/cbt.scala index 5f8f2b5..b97ad44 100644 --- a/stage1/cbt.scala +++ b/stage1/cbt.scala @@ -20,6 +20,9 @@ object `package`{ private val lib = new BaseLib + implicit class CbtBooleanExtensions(condition: Boolean){ + def option[T](value: =>T): Option[T] = if(condition) Some(value) else None + } implicit class CbtStringExtensions(string: String){ def escape = string.replace("\\","\\\\").replace("\"","\\\"") def quote = s""""$escape"""" -- cgit v1.2.3