Merge branch 'master' of github.com:nathanmarz/specter.wiki
This commit is contained in:
commit
2c4ca07c1f
1 changed files with 6 additions and 6 deletions
|
|
@ -217,12 +217,12 @@ This example comes from [a Stack Overflow question](https://stackoverflow.com/qu
|
||||||
```clojure
|
```clojure
|
||||||
=> (defn find-index-route [v data]
|
=> (defn find-index-route [v data]
|
||||||
(let [walker (recursive-path [] p
|
(let [walker (recursive-path [] p
|
||||||
(if-path sequential?
|
(if-path sequential?
|
||||||
[INDEXED-VALS
|
[INDEXED-VALS
|
||||||
(if-path [LAST (pred= v)]
|
(if-path [LAST (pred= v)]
|
||||||
FIRST
|
FIRST
|
||||||
[(collect-one FIRST) LAST p])]))
|
[(collect-one FIRST) LAST p])]))
|
||||||
ret (select-first walker data)]
|
ret (select-first walker data)]
|
||||||
(if (or (vector? ret) (nil? ret)) ret [ret])))
|
(if (or (vector? ret) (nil? ret)) ret [ret])))
|
||||||
#'playground.specter/find-index-route
|
#'playground.specter/find-index-route
|
||||||
=> (find-index-route :my-key '(1 2 :my-key))
|
=> (find-index-route :my-key '(1 2 :my-key))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue