metosin/malli

malli.transform/-interceptor doesn’t support emptly-ish ?interceptor

Open

#596 geöffnet am 17. Dez. 2021

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Clojure (237 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (1.724 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

https://github.com/metosin/malli/blob/152af3a3f8d59cca37a597b2403111bafbdee6ee/src/malli/transform.cljc#L36-L42

Hi,

I’m hitting a corner case with malli transform. I’m still trying to figure out why I’m hitting that corner case and what I can do to avoid that, but I think there’s also a robustness improvement that’s possible in malli.

When the keep function returns an empty list, the reduce function calls the anonymous function on line 38 with no arguments, and this fails.

One possible fix would be to make the anonymous function multi-arity and make it return nil when called with no arguments. Another possible fix would be to check the return value of keep, and only proceed with reducing it if it is a non-empty-list.

Contributor Guide