Tools
You can import these functions to help you with basic tooling functions
Example
import { prefixWithZeros, getDaysInMonth, isTouch } from '@orion.ui/orion';
const numberWithPrefix = prefixWithZeros(15, 6)
// output -> "000015"
const numberOfdays = getDaysInMonth(2, 2023)
// output -> 28
const isTouchableDevice = isTouch()
// output -> false (if from non-touchable device)
Functions
prefixWithZeros(number, length)
string number
number | string length
number = 2hoursToNumber(value, delimiter)
number value
string delimiter
string = ':'sleep(milliseconds)
Promise milliseconds
numberisDefineOrTrue(val)
boolean val
anygetDaysInMonth(weekNumber, year)
number weekNumber
number year
numbergetHoursInterval(start, end, pattern, hourSeparator)
string start
Date end
Date pattern
string = 'De $start à $end' hourSeparator
string = 'h'isIpad()
boolean | undefinedisTouch()
booleanisMac()
booleanisWindows()
booleanhighlightDomElement(element)
void element
(HTMLElement | string | null | undefined)handleTouchDevice()
voiditemHas(item, prop)
boolean item
Record<string, any> prop
anyitemIs(item, validationKeys)
boolean item
Record<string, any> validationKeys
string[]pickFrom(target, keys)
Pick<T, K> target
T extends Record<string, any> keys
(K extends keyof T)[]addPopoverBackdropCloseAbility()
void