1.1.5 • Published 7 years ago

af-utils v1.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

af-utils 1.1.5

bunch of utility/helper functions

src/camelize/camelize.js

camelize(str)

Simple function for change string from snake_case to camelCase

Parameters
NameTypeDescription
strstringstring which will be camelized 
Examples
camelize('foo_bar'); // returns 'fooBar'
camelize('BAR_BAZ'); // returns 'barBaz'
camelize('BAZFOO'); // returns 'bazfoo'
Returns
  • string camelized string

src/debounce/debounce.js

debounce(func, wait, immediate)

Simple function debouncing

Parameters
NameTypeDescription
funcfunctiondunction which will be debounced 
waitnumbernumber of milliseconds to debounce 
immediateanyoptional argument, which if set to true will immediately fire debounced functionOptional
Returns
  • Void

src/deepCompare/deepCompare.js

deepCompare(arg)

Function to deep object comparision

Parameters
NameTypeDescription
argObjectobjects which will be compared to eachself 
Examples
deepCompare({}, {}); // returns true
const obj1 = {
  foo: 'bar',
};

const obj2 = {
  'foo': 'bar'
};

deepCompare(obj1, obj2); // returns true
deepCompare({ foo: true }, { bar: true }); // returns false
Returns
  • boolean true when compared objects are equal, and false when opposite

src/genUuid/genUuid.js

genUuid()

Function for generating universally unique identifier (RFC 4122 v4)

Examples
genUuid() // returns for example: 'c127d3bb-4c34-429b-ab6a-a6b4073ef6d4'
Returns
  • string generated random Uuid

src/isFunction/isFunction.js

isFunction(item)

Simple function which is checking if given argument is a function

Parameters
NameTypeDescription
itemanyanything which should be checked if is function 
Examples
const noop = () => {};

isFunction(noop); // returns true
function noop() {};

isFunction(noop); // returns true
const noop = function() {};

isFunction(noop); // returns true
isFunction({}); // returns false
isFunction('string'); // returns false
Returns
  • boolean true if argument is function, false if not

Documentation generated with doxdox.

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago