UNPKG

549 BJavaScriptView Raw
1const NOFLIP = '/* @noflip */';
2
3// Appends a noflip comment to a style rule in order to prevent it from being automatically
4// flipped in RTL contexts. This should be used only in situations where the style must remain
5// unflipped regardless of direction context. See: https://github.com/kentcdodds/rtl-css-js#usage
6export default function noflip(value) {
7 if (typeof value === 'number') return `${value}px ${NOFLIP}`;
8 if (typeof value === 'string') return `${value} ${NOFLIP}`;
9
10 throw new TypeError('noflip expects a string or a number');
11}