pointfree-jquery

1.9.15 • Public • Published

pointfree-jquery

Curried a few common jQuery methods to allow them to be written in a point free fashion.

npm install --save pointfree-jquery

import { compose, map, hide, show } from 'pointfree-jquery';
import $ from 'jquery';
import IO from 'fantasy-io';
 
const blink = map(compose( 
    show('slow'),
    hide('fast')
));
 
const program = compose( 
    blink,
    IO
);
 
program(_ => $('body')).unsafePerform();
 

All methods receive their data as the last argument.

import { addClass, css, on, compose, map } from 'pointfree-jquery';
import $ from 'jquery';
import IO from 'fantasy-io';
 
const logInfo = function(e) { 
    console.log(this, e);
};
 
const handler = compose( 
    on('click', logInfo),
    css({ 'background': 'green' }),
    addClass('example')
);
 
const program = compose( 
    map(handler),
    IO
);  
 
program(_ => $('body')).unsafePerform();
 

EFFECTS

  • addClass
  • css
  • fadeIn
  • fadeOut
  • fadeTo
  • fadeToggle
  • hide
  • removeclass
  • show
  • slideToggle
  • slideUp
  • toggle

HANDLERS

  • bind
  • blur
  • change
  • click
  • contextmenu
  • dblclick
  • die
  • focus
  • focusout
  • keydown
  • keypress
  • keyup
  • live
  • load
  • mousedown
  • mouseenter
  • mouseleave
  • mousemove
  • mouseup
  • on
  • resize
  • scroll
  • select
  • submit
  • unbind
  • unload

UTILS

  • compose
  • curry
  • map
  • trace

Dependents (0)

Package Sidebar

Install

npm i pointfree-jquery

Weekly Downloads

22

Version

1.9.15

License

MIT

Last publish

Collaborators

  • coreyclark