[]
the array without false values
Remove duplicates values in arrays
[]
the array without duplicates
Remove false values in arrays (include 0)
Example: ARRAY.removeFalsy([0, 'a string', '', NaN, true, 5, undefined, false]) // ['a string', true, 5]
[]
the array without false values
Get a random hexadecimal color
hexadecimal color
Convert rgb color to hexadecimal
Example: const colorHex = COLOR.rgbToHex(255, 255, 255) // #ffffff
number between 0 and 255
number between 0 and 255
number between 0 and 255
hexadecimal color
Clean all cookies
Check is user prefers dark mode
boolean
Calculate the number of the day of the year
Example: const day = DATE.dayOfYear(new Date())
Date
number of day of year
Calculate days difference between 2 dates
Example: const startDate = new Date("1986-03-05") const endDate = new Date() const daysDiff = DATE.daysDiff(startDate, endDate)
Date
Date
number of days difference
Calculate average of numbers
Example: const day = NUMBER.average(1, 2, 3, 4, 5, ...) // 3
Numbers of calculate (1, 2, ...)
number average
Calculate is even
number
boolean
Calculate random number by min and max
Example: const numberBetween1and100 = NUMBER.randomMinMax(1, 100)
minimum number
maximum number
random number
Round a decimal to the indicated amount
Example: const numberRounded = NUMBER.roundDecimal(1.0135, 2) // 1.01 const numberRounded = NUMBER.roundDecimal(1.0185, 2) // 1.02
number with decimals
number of decimal
random number
Copies one object with another without losing properties
Example: const objectMerged = mergeObjects({hello: 'World'}, {object: 'toCopy}) // { hello: 'World', object: 'toCopy }
object to merge
new Values for object
Object
Create a uses asynchronous pause
Example: PROMISE.pause(1000).then(...) await PROMISE.pause(1000)
pause time in milliseconds
Promise
Wrapper for a promise including a try catch by default it shows error by console
Example: const promise = fetch(...) PROMISE.tryCatchWrapper(promise).then(...)
pause time in milliseconds
optional ()
Promise
Escape html code
Example: const htmlClean = STRING.htmlEscape('
string to convert
string converted
Get random letters
string created
replace all text in string
Example: const textReplaced = STRING.replaceall(text, textToReplace, textReplace)
string complete
string to search for replace
new string
string converted
convert text string to camelCase
Example: const stringCamelCase = STRING.toCamelCase('background-color') // "backgroundColor"
string to convert
string converted
Lowercase all words
Example: const wordsConverted = STRING.toLowerCase('Hello World!') // "hello world!" const wordsConverted = STRING.toLowerCase('Hello World!', true) // "hello World!"
string to convert
boolean optional for only change first letter
string converted
Capitalize all words
Example: const wordsConverted = STRING.toUpperCase('hello world!') // "Hello World!" const wordsConverted = STRING.toUpperCase('hello world!', true) // "Hello world!"
string to convert
boolean optional for only change first letter
string converted
Generated using TypeDoc
Convert array in simple array Example: const arrayFlated = ARRAY.flat([0, [1, 2, 3]]) // [0, 1, 2, 3]