about summary refs log tree commit diff stats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/curry.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/curry.js b/js/curry.js
new file mode 100644
index 0000000..1d2266c
--- /dev/null
+++ b/js/curry.js
@@ -0,0 +1,11 @@
+function curry(fn) {
+  const arity = fn.length;
+
+  return function $curry(...args) {
+    if (args.length < arity) {
+      return $curry.bind(null, ...args);
+    }
+
+    return fn.call(null, ...args);
+  };
+}