4 ms·
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
by dugmartin 16y ago
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);