@deskpro/js-utils
v1.0.13
Published
Deskpro library of common js methods
Downloads
720
Readme
@deskpro/js-utils
Library of common js methods
Installation
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
Utilities
debounce
Allow to debounce a functionnewid
Generates a unique id value.noop
Provides an empty function to use as a default callback.
Numbers
- 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
- 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
- strings/trimString
Trim a string to a certain length with an ellipsis - strings/capitalize
Put the first letter of a string in capital