λ

JFP: Javascript Function Processor

##Conditional Functions

either

####Example

j.either('default', null); // default
j.either('default', 'my string'); // my string
j.either(10, 0, 'number'); // 0

eitherIf

####Example

j.eitherWhen('default', 'yay!', true);

//yay!

j.eitherWhen('default', null, true);

//default

j.eitherWhen('default', 'yay!', false);

//default

eitherType

###Example

// All of the following execution patterns are equivalent
j.eitherType('string', 'default', null); // default
j.eitherType('string', 'default')(null);
j.eitherType('string')('default', null);
j.eitherType('string')('default')(null);

eitherWhen

####Example

j.eitherWhen('default', false, j.identity);

//default

j.eitherWhen('default', true, j.partial(j.identity, false));

//default

j.eitherWhen('default', true, j.partial(j.identity, 'yay!'));

//yay!

maybe

maybeType

###Example

var maybeString = j.maybeType('string');

maybeString('foo'); // foo
maybeString({}); // null
j.maybeType('string')([]); // null
j.maybeType('string', []); // null

####Example

j.maybe(undefined); // null
j.maybe('foo'); // foo
j.maybe(5, 'string'); // null
j.maybe(0, 'number'); // 0

when

####Example

when(true, function(myValue){ console.log(myValue); }, "Hello, world!");

//Hello, world!