bunch of utility/helper functions
Simple function for change string from snake_case to camelCase
| Name | Type | Description | |
|---|---|---|---|
| str | string |
string which will be camelized |
camelize('foo_bar'); // returns 'fooBar'camelize('BAR_BAZ'); // returns 'barBaz'camelize('BAZFOO'); // returns 'bazfoo'stringcamelized string
Simple function debouncing
| Name | Type | Description | |
|---|---|---|---|
| func | function |
dunction which will be debounced | |
| wait | number |
number of milliseconds to debounce | |
| immediate | any |
optional argument, which if set to true will immediately fire debounced function | Optional |
Void
Function to deep object comparision
| Name | Type | Description | |
|---|---|---|---|
| arg | Object |
objects which will be compared to eachself |
deepCompare({}, {}); // returns trueconst obj1 = {
foo: 'bar',
};
const obj2 = {
'foo': 'bar'
};
deepCompare(obj1, obj2); // returns truedeepCompare({ foo: true }, { bar: true }); // returns falsebooleantrue when compared objects are equal, and false when opposite
Function for generating universally unique identifier (RFC 4122 v4)
genUuid() // returns for example: 'c127d3bb-4c34-429b-ab6a-a6b4073ef6d4'stringgenerated random Uuid
Simple function which is checking if given argument is a function
| Name | Type | Description | |
|---|---|---|---|
| item | any |
anything which should be checked if is function |
const noop = () => {};
isFunction(noop); // returns truefunction noop() {};
isFunction(noop); // returns trueconst noop = function() {};
isFunction(noop); // returns trueisFunction({}); // returns falseisFunction('string'); // returns falsebooleantrue if argument is function, false if not
Documentation generated with doxdox.