Skip to content

Commit

Permalink
Removed higher order function which is no longer necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Heggelund Hansen committed Nov 9, 2014
1 parent 2b48ca8 commit bc8aefe
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/bouncer/core.cljx
Expand Up @@ -135,18 +135,17 @@ If you'd like to know more about the motivation behind `bouncer`, check the
Chain of responsibility.
Takes a collection of validators `fs` and returns a `state monad`-compatible function.
Takes the current state and a collection of validators `fs`
This function will run all validators against `old-state` and eventually return a vector with the result - the errors map - and the new state - the original map augmented with the errors map.
Will run all validators against `old-state` and eventually return a vector with the result - the errors map - and the new state - the original map augmented with the errors map.
See also `wrap`
"
[message-fn & fs]
(fn [old-state]
(let [new-state (reduce (partial wrap message-fn)
old-state
fs)]
[(::errors new-state) new-state])))
[old-state message-fn & fs]
(let [new-state (reduce (partial wrap message-fn)
old-state
fs)]
[(::errors new-state) new-state]))

(defn- validate*
"Internal use.
Expand All @@ -158,7 +157,7 @@ If you'd like to know more about the motivation behind `bouncer`, check the
(loop [[errors state :as ret] [nil m]
fs fs]
(if (seq fs)
(recur ((wrap-chain message-fn (first fs)) state) (rest fs))
(recur (wrap-chain state message-fn (first fs)) (rest fs))
ret)))

;; ## Public API
Expand Down

0 comments on commit bc8aefe

Please sign in to comment.