Constructor
new FlavorJS()
constructs FlavorJS class & extends the js natives
Methods
delay(fn, ms) → {function}
- Source:
delays a function by specified ms
Example
eg. usage
ƒ.delay(function() {
console.log('ended')
}, 1000);
// it logs 'ended' after 1000ms
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | function to invoke |
ms |
number | time to wait in milliseconds |
Returns:
- Type
- function
extendArray()
extendArray
extendBoolean()
extendBoolean
extendDate()
extendDate
extendFunction()
extendFunction
extendLodash()
extendLodash
extendNumber()
extendNumber
extendObject()
extendObject
extendPrototype(proto, extend)
merges all keys in extend plain object to the prototype (
Parameters:
Name | Type | Description |
---|---|---|
proto |
prototype | object | the prototype/object to extend |
extend |
object | the extend object to be merged in prototype |
extendPrototypeProperty(proto, prop, val, optionsopt)
safe js native prototype extension using Object.defineProperty
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
proto |
prototype | object | the prototype/object to extend | ||||||||||||||||||||||||||||||||
prop |
string | the name of the property to be defined or modified | ||||||||||||||||||||||||||||||||
val |
* | val to be used as value in the descriptor for the property, can be any kind of native (number, function, etc...) or what you want | ||||||||||||||||||||||||||||||||
options |
object |
<optional> |
{}
|
options to be used as parameters in the descriptor for the property possible options are (source documentation from Javascript|MDN docs) Properties
|
extendString()
extendString
init()
initialize all