@lindajs/library
v1.0.0
Published
### Table of Contents
Downloads
1
Readme
@TODO: FIX THIS README - LOT OF BULLCRAP IN HERE
Table of Contents
Id
ID-Generator with optional prefix
Parameters
seed
bln
prefix
Returns string
size
Returns number
singleton
Ensures that only one instance for the wrapped module is instantiated. 'real' Singleton...
Parameters
id
string the unique id under which the module is stored in the global namespacemdl
Object the module variable that is passed to each node/browserify modulefn
function function that wraps the code of the module
Examples
let {singleton} = require('@linda/lib')
singleton('SymbolName', module, module.exports = function XXX () {
// ...
}
Utilities
isArray
Parameters
obj
Returns (Array<any> | boolean)
isArrayLike
Parameters
arr
Returns (any | boolean)
each
Parameters
coll
iterator
arrayEach
Parameters
arr
iterator
forEachOf
Parameters
object
iterator
keyIterator
Parameters
coll
Returns next
withoutIndex
Parameters
iterator
Returns Function
aggregate
Aggregation of multiple Classes to single mixin Class
Parameters
base
objectmixins
any
Returns object aggregate
addEventListener
Parameters
emitter
!NodeJS.EventEmittereventName
stringhandler
function (?)
Returns {emitter: !NodeJS.EventEmitter, eventName: string, handler: function (?)}
removeEventListeners
Parameters
listeners
<{emitter: !NodeJS.EventEmitter, eventName: string, handler: function (?)}>
Timetrack
Time-tracking Utility
Parameters
Examples
let {tracking} = require('@linda/lib') -
let track = new tracking() // - starts tracking.
tracking.stop() // - stop tracking and returns a formatted string.
Type
equal
equal
Parameters
value
object
Returns (boolean | any)
register
register
Parameters
is
Parameters
value
any
Returns boolean
expr
Define the type what type it should be. - being one OR a combination (|) of: 'boolean', 'number', 'string', 'function', 'array', 'arguments', 'regexp', 'date', 'object', 'null', 'undefined', 'primitive', 'map', 'set', 'weakmap', 'weakset', 'symbol'.
Optional prefix: '?' = nullable/optional, '!' = exclusive
Parameters
type
Examples
let undefinedValue = undefined;
type.isValue(undefinedValue).typeOf(object); // false
type.isValue(undefinedValue).typeOf(?object); // true
type.isValue(undefinedValue).typeOf(!undefined); // true
Returns boolean true/false -