functastique
v0.1.2
Published
A collection of nice little creatures to aid writing in functional style
Downloads
3
Readme
#This is functastique
A collection of nice little creatures to aid writing in functional style.
#API
##Index
Functions
- curry(f, [arity])
- compose(...functions)
- flip(f)
- not(f)
- get(p, o)
- translate(dictionary, key)
- is(type, o)
- is_instance_of(constructor, o)
- is_equal(x, y)
##curry(f, [arity])
Curry function f
. Resulting function takes single argument and
returns function until receiving all arguments at which time it invokes
f
with all supplied arguments.
Params
- f
function
- [arity=f.length]
Number
- Optional arity off
. Useful for currying variadic functions (accepting varying number of arguments).
Returns: function
##compose(...functions)
Compose functions. Resulting function when invoked will execute
functions
starting with the last one and use it's result as
arguments for the next one.
Params
- ...functions
function
Returns: function
##flip(f)
Create a function which when invoked, will call function f
with
arguments in reverse order.
Params
- f
function
Returns: function
##not(f)
Create a negation of function f
. I.e. not(f)(x) = !f(x).
Params
- f
function
Returns: function
##get(p, o)
Gets value of property p
of object o
.
Params
- p
String
- o
Object
Returns: *
##translate(dictionary, key)
Gets value of property key
of object dictionary
. Similar to
get except with arguments reversed.
Params
- dictionary
Object
- key
String
Returns: *
##is(type, o)
Returns true
if o
is of type type
and false
otherwise.
Params
- type
String
- o
Object
Returns: Boolean
##is_instance_of(constructor, o)
Returns true
if o
has constructor.prototype
somewhere in
it's prototype chain and false
otherwise.
Params
- constructor
function
- o
Object
Returns: Boolean
##is_equal(x, y)
Returns true
is x
is strictly equal to y
and false
otherwise.
Params
- x
*
- y
*
Returns: Boolean
#License
This software is public domain. For fine details, see UNLICENSE file or unlicense.org. Basically, it means you can do whatever you like with this software, but contributing back is always appreciated.