Kondico
Functional conditions and compositions (uses Formi).
Status
API Docs
Kondico exposes the Kondico
function.
Kondico(boolean, [options])
-> FunctionKondico(func, [options])
-> Function
Kondico(boolean, [options])
Defines function that returns input boolean.
Example
var isTrue = ;; // ==> true
Kondico(func, [options])
Defines function that returns result of a called function.
Example
var isDefined = ; // true // false
Kondico Options
Option | Value | Description |
---|---|---|
once | Boolean | Only run function body once, cache result |
memoize | Boolean/Function | Only run function body once per input value |
Kondico(func, { once: true })
Defines a function that runs it's body a single time, any subsequent calls will return that same value without running that function body.
Example
var hasJquery = ; if ; ;
Kondico(func, { memoize: true })
Defines a function that runs it's body a single time for each unique input, any subsequent calls with the same input will return the same value without running the function body.
memoize
option can be a boolean value or a hashFunction that returns an id used to cache a functions return; hashFunction will return first argument by default.
Example
var has = ; if ; ;
Compositions (Logic Gates)
Kondico defines logic gate function for composing more complex conditions. All functions will operate on any number of arguments. not
returns an array if more than one argument is passed.
Kondico.not
Kondico.or
Kondico.and
Kondico.nor
Kondico.nand
Kondico.xor
Kondico.xnor
Example Useages
Media Queries
var smallSize = ; var largeSize = ;var mediumSize = Kondico; // example window size (960x720) // false // true // false
Feature Detection
var hasCanvas = ;