Library of common js methods
The easiest way to use js-utils
is to install it from npm and build it into your app with Webpack.
npm i @deskpro/js-utils --save
-
debounce
Allow to debounce a function -
newid
Generates a unique id value. -
noop
Provides an empty function to use as a default callback.
- numbers/numberFormat
Formats a number to include commas (or any separator) in the thousandths place. - numbers/numberRandom
Returns a random whole number between a minimum and maximum number. - numbers/formatFileSize
Format a file size into a human readable string
- objects/objectKeyFilter
Performs a key comparison between two objects, deleting from the first where the keys exist in the second. - objects/objectForEach
Iterates over an object. - objects/objectMap
Creates an array from the results of calling a function on each item in an object.
- strings/trimString
Trim a string to a certain length with an ellipsis - strings/capitalize
Put the first letter of a string in capital