We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6834668 commit 0323346Copy full SHA for 0323346
src/axel_f/compiler.cljc
@@ -24,9 +24,12 @@
24
(reduce
25
(fn [_ x]
26
(when (map? x)
27
- (when-let [v (or (get x idx)
28
- (get x (switch-type idx)))]
29
- (reduced v))))
+ (let [idx' (switch-type idx)]
+ (cond
+ (and (contains? x idx) (some? (get x idx)))
30
+ (reduced (get x idx))
31
+ (and (contains? x idx') (some? (get x idx')))
32
+ (reduced (get x idx'))))))
33
nil ctxs))
34
35
(defn lookup [ctx [p & path]]
test/axel_f/reference_test.cljc
@@ -69,3 +69,9 @@
69
(t/deftest reference-can-start-with-number
70
(t/is (= 1
71
((af/compile "1to1.foo") {"1to1" {:foo 1}}))))
72
+
73
+(t/deftest falsy-values
74
+ (t/is (= [false true 1]
75
+ ((af/compile "foo.[].bar") {"foo" [{:bar false}
76
+ {"bar" true}
77
+ {"bar" 1}]}))))
0 commit comments