kfirmanty / threading-operator

Clj/cljs threading operator ported to JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Threading Operator for JS

Small utility code to bring functionality of Clj/Cljs thread macros https://clojuredocs.org/clojure.core/-%3E to JS.

Example usage

threadFirst(10, [(a, b) => a / b, 20]) // returns 0.5
threadLast(10, [(a, b) => a / b, 20]) // returns 2
threadLast(10, [(a, b) => a / b, 20], [(a, b) => a * b, 100]) // returns 200
threadFirst(10, [Math.pow, 2], Math.sqrt) // returns 10

About

Clj/cljs threading operator ported to JS


Languages

Language:JavaScript 100.0%