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 = 2
hoursToNumber(value, delimiter)
number
value
string
delimiter
string = ':'
sleep(milliseconds)
Promise
milliseconds
number
isDefineOrTrue(val)
boolean
val
any
getDaysInMonth(weekNumber, year)
number
weekNumber
number
year
number
getHoursInterval(start, end, pattern, hourSeparator)
string
start
Date
end
Date
pattern
string = 'De $start à $end'
hourSeparator
string = 'h'
isIpad()
boolean | undefined
isTouch()
boolean
isMac()
boolean
isWindows()
boolean
highlightDomElement(element)
void
element
(HTMLElement | string | null | undefined)
handleTouchDevice()
void
itemHas(item, prop)
boolean
item
Record<string, any>
prop
any
itemIs(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