fp
fun with functional programming in js
Methods
fp.fst(fn): Returns a function that calls fn with only the first argument passed.
fp.snd(fn): Returns a function that calls fn with only the second argument passed.
fp.thd(fn): Returns a function that calls fn with only the third argument passed.
fp.nthArg(nth, fn): Returns a function that calls fn with only the nth argument passed.
Example
'use strict'; var fp = items = 'foo' 'bar' 'baz' _ = indentLog = _; console;console; items; console;console; items; console;console;items;
This produces:
$ node example/log.js
Just passing console.log by itself:
foo 0 [ 'foo', 'bar', 'baz' ]
bar 1 [ 'foo', 'bar', 'baz' ]
baz 2 [ 'foo', 'bar', 'baz' ]
Wrapping console.log in fp.fst to only get the keys:
foo
bar
baz
Wrapping console.log in fp.snd to only get the values:
0
1
2
Contributing
PRs welcome. I don't have a specific direction in mind yet for this package; I just wanted someplace to stick the small functional tools I keep replicating between projects.