@mightyplow/jslib

js helpers library

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@mightyplow/jslib
0.21.16 years ago8 years agoMinified + gzip package size for @mightyplow/jslib in KB

Readme

Objects

array : object
function : object
html : object
object : object
string : object
stylesheet : object

array : object

Kind: global namespace
* [.chunkedForEach(ar, fn, chunkSize)](#array.chunkedForEach) ⇒ <code>Promise</code>
* [.ensureArray(val)](#array.ensureArray)
* [.module.exports(ar)](#array.module.exports) ⇒ <code>\*</code>
* [.module.exports(ar)](#array.module.exports) ⇒ <code>Array</code>
* [.head(ar)](#array.head) ⇒ <code>\*</code>
* [.tail(ar)](#array.tail) ⇒ <code>T</code>
* [.toArray(arraylike)](#array.toArray)
* [.module.exports(ar)](#array.module.exports)

array.chunkedForEach(ar, fn, chunkSize) ⇒ Promise

Splits an array into chunks and breaks the execution queue to ensure reactivity.
Kind: static method of array
| Param | Type | | --- | --- | | ar | Array | | fn | function | | chunkSize | number |

array.ensureArray(val)

Kind: static method of array
| Param | | --- | | val |

array.module.exports(ar) ⇒ \*

Kind: static method of array
| Param | | --- | | ar |

array.module.exports(ar) ⇒ Array

Returns all values of an array, which are not undefined.
Kind: static method of array
| Param | Type | | --- | --- | | ar | Array |

array.head(ar) ⇒ \*

Kind: static method of array
| Param | | --- | | ar |

array.tail(ar) ⇒ T

Kind: static method of array
| Param | | --- | | ar |

array.toArray(arraylike)

Kind: static method of array
| Param | | --- | | arraylike |

array.module.exports(ar)

Kind: static method of array
| Param | | --- | | ar |

function : object

Kind: global namespace
* [.enqueueWithResults](#function.enqueueWithResults) ⇒
* [.argsToArray(fn)](#function.argsToArray) ⇒ [<code>function</code>](#function)
* [.checkTypes()](#function.checkTypes)
* [.combine()](#function.combine) : [<code>function</code>](#function)
* [.curry(fn)](#function.curry) ⇒ <code>curried</code>
* [.module.exports(fn, timeout)](#function.module.exports) ⇒ [<code>function</code>](#function)
* [.enqueue(promiseGenerators)](#function.enqueue) ⇒
* [.indentity(arg)](#function.indentity)
* [.measureTime(label, fn)](#function.measureTime)
* [.memoize(fn, [timeout])](#function.memoize) ⇒ [<code>function</code>](#function)
* [.module.exports()](#function.module.exports)
* [.promisify(fn, context)](#function.promisify)

function.enqueueWithResults ⇒

Returns a function which executes promises one after another. The resulting function returns a promise, which gets filled with an array of the results of the single promises.
Kind: static constant of function
Returns: function which executes the promises
| Param | Description | | --- | --- | | promiseGenerators | an array of functions which return a promise |

function.argsToArray(fn) ⇒ function

Kind: static method of function
| Param | | --- | | fn |

function.checkTypes()

Kind: static method of function

function.combine() : function

Kind: static method of function

function.curry(fn) ⇒ curried

Kind: static method of function
| Param | | --- | | fn |

function.module.exports(fn, timeout) ⇒ function

Creates a function which debounces with the given timeout and resets the timer on every function call.
The returned debounced function has a function property abort() which aborts the timer.
Kind: static method of function
| Param | Type | | --- | --- | | fn | function | | timeout | number |

function.enqueue(promiseGenerators) ⇒

returns a function which executes promises one after another
Kind: static method of function
Returns: function which executes the promises
| Param | Description | | --- | --- | | promiseGenerators | an array of functions which return a promise |

function.indentity(arg)

Kind: static method of function
| Param | | --- | | arg |

function.measureTime(label, fn)

Takes a function and logs the time it takes on the console.
Kind: static method of function
| Param | | --- | | label | | fn |

function.memoize(fn, timeout) ⇒ function

Caches a function result for a specified time.
Kind: static method of function
| Param | Type | Description | | --- | --- | --- | | fn | function | the function of which the result should be cached | | timeout | number | the time in ms which tells the time after which the results should be deleted from the cache |

function.module.exports()

Kind: static method of function

function.promisify(fn, context)

Kind: static method of function
| Param | | --- | | fn | | context |

html : object

Kind: global namespace

html.createLinkTag(filename, mediaQuery) ⇒ string

Kind: static method of html
| Param | | --- | | filename | | mediaQuery |

object : object

Kind: global namespace
* [.defaults(obj, values)](#object.defaults) ⇒ <code>Object</code>
* [.extract(props)](#object.extract) ⇒ [<code>function</code>](#function)
* [.filter(obj, pred)](#object.filter) ⇒ <code>\*</code>
* [.fromArray(array, key, keep)](#object.fromArray) ⇒ <code>\*</code>
* [.merge(targetObject, objects)](#object.merge) ⇒ <code>Object</code>
* [.prop(prop)](#object.prop) ⇒ [<code>function</code>](#function)
* [.removeProp(object)](#object.removeProp)

object.defaults(obj, values) ⇒ Object

Populates an object with default values.
Kind: static method of object
Returns: Object - a new object with the default values and the object values
| Param | Type | Description | | --- | --- | --- | | obj | Object | the object to populate the values on | | values | Object | the default values to populate on the target object |

object.extract(props) ⇒ function

Creates a function which extracts some properties out of an object.
Kind: static method of object
| Param | Type | | --- | --- | | props | Array.<string> |

object.filter(obj, pred) ⇒ \*

Kind: static method of object
| Param | | --- | | obj | | pred |

object.fromArray(array, key, keep) ⇒ \*

Receives an array of objects and extracts an object with the given key as index. The key must be a property of the array items. If the property is not found on the item, the item is omitted.
Kind: static method of object
| Param | Type | Description | | --- | --- | --- | | array | Array.<Object> | | | key | string | | | keep | boolean | should the extracted prop be kept in the result object |

object.merge(targetObject, objects) ⇒ Object

Merges too objects deeply.
Kind: static method of object
| Param | Type | | --- | --- | | targetObject | Object | | objects | Array.<Object> |

object.prop(prop) ⇒ function

Creates a function which returns a property of a passed object.
Kind: static method of object
Returns: function - function to return a property from a passed object
| Param | Type | Description | | --- | --- | --- | | prop | string | the property to return from the passed object |

object.removeProp(object)

Kind: static method of object
| Param | | --- | | object |

string : object

Kind: global namespace
* [.append(str, append)](#string.append)
* [.ciCompare(val1, val2)](#string.ciCompare)
* [.toBool(val)](#string.toBool)

string.append(str, append)

Kind: static method of string
| Param | | --- | | str | | append |

string.ciCompare(val1, val2)

Kind: static method of string
| Param | | --- | | val1 | | val2 |

string.toBool(val)

Kind: static method of string
| Param | | --- | | val |

stylesheet : object

Kind: global namespace
* [.createStylesheetAst(rules)](#stylesheet.createStylesheetAst) ⇒ <code>Object</code>
* [.getRules(css)](#stylesheet.getRules)
* [.isRuleType(type)](#stylesheet.isRuleType)

stylesheet.createStylesheetAst(rules) ⇒ Object

Kind: static method of stylesheet
| Param | | --- | | rules |

stylesheet.getRules(css)

Kind: static method of stylesheet
| Param | | --- | | css |

stylesheet.isRuleType(type)

Kind: static method of stylesheet
| Param | | --- | | type |