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

Very nice.

Although I think the documentation would be better served by first showing the code. Its very short and very self explanatory. It's double awesome that it hooks into Functional Javascript.

Here is the code:

    ;(function ($) {
      $.fn.K = function (fn) {
        fn = typeof(Functional) != 'undefined' ? Functional.lambda(fn) : fn;
        fn(this);
        return this;
      };
      if (typeof($.fn.tap) == 'undefined')
        $.fn.tap = $.fn.K;
      $.fn.T = function (fn) {
        fn = typeof(Functional) != 'undefined' ? Functional.lambda(fn) : fn;
        return fn(this);
      };
      if (typeof($.fn.into) == 'undefined')
      $.fn.into = $.fn.T;
    })(jQuery);


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

Search: