diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2018-11-12 16:18:45 -0500 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2018-11-12 16:18:45 -0500 |
commit | 5ed62d23b4bbbf7717de4adfa0eaf2af19365408 (patch) | |
tree | aa3285b40f9905e45b33f61b77afa06a0d33a790 /assets/viz/2/quil/middlewares/deprecated_options.cljc | |
parent | 886684ec4c0a3d032a974ae8b8e29fb0e0632125 (diff) |
add viz 2 post
Diffstat (limited to 'assets/viz/2/quil/middlewares/deprecated_options.cljc')
-rw-r--r-- | assets/viz/2/quil/middlewares/deprecated_options.cljc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/assets/viz/2/quil/middlewares/deprecated_options.cljc b/assets/viz/2/quil/middlewares/deprecated_options.cljc new file mode 100644 index 0000000..6ed40d2 --- /dev/null +++ b/assets/viz/2/quil/middlewares/deprecated_options.cljc @@ -0,0 +1,26 @@ +(ns quil.middlewares.deprecated-options) + +(def ^:private deprecated + {:decor ["2.0" "Try :features [:present] for similar effect"] + :target ["2.0" "Use :features [:keep-on-top] instead."] + :safe-draw-fn ["2.0" "Use :features [:no-safe-fns] instead."]}) + +(defn- check-features-vector [features] + (let [features (set features)] + (when (features :no-safe-draw) + (println "Feature :no-safe-draw was renamed to :no-safe-fns in Quil 2.1." + "Use :feature [:no-safe-fns] now.")) + (disj features :no-safe-draw))) + +(defn deprecated-options + "Checks if options map contains deprected options and removes them. + Prints messages how to fix deprecated functions." + [options] + (let [options (update-in options [:features] check-features-vector)] + (->> (for [[name value] options] + (if-let [[version message] (deprecated name)] + (do (println name "option was removed in Quil" version "." message) + nil) + [name value])) + (remove nil?) + (into {})))) |