npm i @minsize/utils
yarn add @minsize/utils
Function | Description |
---|---|
chunks |
Splits an array into pieces of the given size. |
clamp |
Limits the number to the specified minimum and maximum value. |
decWord |
The function returns a string representing the correct ending of the word depending on the number. |
alignTo |
The function returns an aligned number. |
toShort |
The function returns a string representing the number in short form. |
timeAgo |
The function returns a string describing the time elapsed since timestamp. |
formatNumber |
Formats a number into a delimited string. |
shuffle |
Shuffles the elements of an array in random order. |
random |
Generates a random number within the specified range. |
isType |
Checks if the value is of the specified type. |
omit |
Returns a new object with no specified keys. |
pick |
Returns a new object with the selected keys. |
sleep |
Waits for the specified number of milliseconds. |
copyText |
The function allows you to copy text to the clipboard. |
createLinksFromText |
The function returns an array containing text fragments and the results of the callback call for each block. |
HSVtoRGB |
The function converts color from HSV color model (hue, saturation, brightness) to RGB color model (red, green, blue). |
RGBtoHEX |
The function converts color from the RGB color model (red, green, blue) to hexadecimal format (HEX). |
RGBtoHSV |
The function converts color from the RGB (red, green, blue) color model to the HSV (hue, saturation, brightness) color model. |