Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We have a special on combinators this evening. Why not try a side order?

    function explicitize (fn) {
      return function () {
        return fn.apply(null, p(arguments, this));
      }
    }
Now you can write:

    foo.prototype.bar = explicitize(function (myself, something, etc) {
      // ...
    }


that's pretty much what I meant by wrapped in a utility function... generally... something akin to explitize(ConstructorName, 'methodname') .. so that the passthrough call(s) can be shimmed/mocked for testing...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: