aboutsummaryrefslogtreecommitdiffstats
path: root/state.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-11-03 16:35:31 +0000
committers-ol <s-ol@users.noreply.github.com>2019-11-03 16:35:31 +0000
commit72e7dee17015295cc691fade5b3edefd9c5bf059 (patch)
tree27778e3c222adaa35a74e0fd87f1898ada28bbae /state.moon
parentupdate examples, fixes (diff)
downloadwatch-cad-72e7dee17015295cc691fade5b3edefd9c5bf059.tar.gz
watch-cad-72e7dee17015295cc691fade5b3edefd9c5bf059.zip
test is_once and is_live
Diffstat (limited to 'state.moon')
-rw-r--r--state.moon26
1 files changed, 8 insertions, 18 deletions
diff --git a/state.moon b/state.moon
index 5a3170c..7630fb1 100644
--- a/state.moon
+++ b/state.moon
@@ -4,23 +4,12 @@ class Once
new: (@value) =>
@is_once: (val) ->
- return unless val
- return unless 'table' == type val
+ return false unless val
+ return false unless 'table' == type val
val.__class == @@
-all = (f) -> (...) ->
- values = for i = 1, select '#', ...
- val = f select i, ...
- return unless val
- val
-
- unpack values
-
is_once = (val) -> (Once.is_once val) and val.value
-is_live = (val) -> (not is_once val) and val
-
-are_once = all is_once
-are_live = all is_live
+is_live = (val) -> (not Once.is_once val) and val
class Cursor
@__base.__index = do
@@ -65,8 +54,8 @@ class Cursor
__eq: (other) => @path == other.path
@is_cursor: (val) ->
- return unless val
- return unless 'table' == type val
+ return false unless val
+ return false unless 'table' == type val
val.__class == @@
class State
@@ -102,8 +91,9 @@ class State
@root = Cursor @
{
- :is_once, :are_once
- :is_live, :are_live
+ :is_once
+ :is_live
:Once
+ :Cursor
:State
}