This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toHyphenated(styleKey) { | |
return styleKey.replace(/([A-Z])/g, "-$1").toLowerCase(); | |
} | |
const log = (...args) => { | |
console.log(...args); | |
}; | |
Object.assign(log, { | |
if(condition) { | |
return { | |
then(callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getStickyRoot(node: Element) { | |
let current = node.parentElement; | |
while (current && current !== document.body) { | |
const computedStyle = window.getComputedStyle(current); | |
const overflow = computedStyle.getPropertyValue('overflow'); | |
if (overflow === 'scroll' || overflow === 'auto') { | |
return current; | |
} | |
current = current.parentElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ordinalizeNumber = n => { | |
const rule = new Intl.PluralRules('en-US', { type: 'ordinal' }).select(n); | |
const suffix = ({ | |
one: 'st', | |
two: 'nd', | |
few: 'rd', | |
other: 'th', | |
})[rule]; | |
return `${n}${suffix}`; | |
} |