1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-25 07:50:27 +00:00

Merge pull request #752 from sogaiu/get-in-tweak

Tweak get-in behavior
This commit is contained in:
Calvin Rose 2021-08-06 15:14:33 -05:00 committed by GitHub
commit 2e641a266d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -1381,7 +1381,7 @@
a sequence of keys.`
[ds ks &opt dflt]
(var d ds)
(loop [k :in ks :while d] (set d (get d k)))
(loop [k :in ks :while (not (nil? d))] (set d (get d k)))
(if (= nil d) dflt d))
(defn update-in

View File

@ -161,4 +161,10 @@
([err] :caught))))
"regression #638"))
# Issue #751
(def t {:side false})
(assert (nil? (get-in t [:side :note])) "get-in with false value")
(assert (= (get-in t [:side :note] "dflt") "dflt")
"get-in with false value and default")
(end-suite)