最常用地方:react-redux的connect函数

    1. // 支持多参数传递
    2. var processCurry = function (fn, args) {
    3. var self = this
    4. var len = fn.length
    5. var args = args || []
    6. return function () {
    7. var _args = Array.prototype.slice.call(arguments)
    8. var arg = args.concat(_args);
    9. if (arg.length < len) {
    10. return processCurry.call(self, fn, arg)
    11. }
    12. return fn.apply(self, arg)
    13. }
    14. }
    15. var add = function (a, b, c, d) {
    16. console.log(a + b + c + d);
    17. return a + b + c + d
    18. }
    19. var addCurry = processCurry(add)
    20. addCurry(1)(2, 3)(4)