Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arvin iuunhao
Added: Jun 18, 2018 8:19 AM
Views: 9
Tags: js
柯里化
  1. const curry = (fn, arity = fn.length, ...args) =>
  2.   arity < = args.length
  3.     ? fn(...args)
  4.     : curry.bind(null, fn, arity, ...args);
  5. // curry(Math.pow)(2)(10) -> 1024
  6. // curry(Math.min, 3)(10)(50)(2) -> 2