@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
8 lines • 326 B
JavaScript
import { isCalc } from './is-calc';
const percentageOrEmOrAuto = /(%$)|(\d+em$)|(auto$)/;
export const removePixelSuffix = value => {
if (typeof value === 'string' && (percentageOrEmOrAuto.test(value) || isCalc(value))) {
return value;
}
return Number(typeof value === 'string' ? value.replace('px', '') : value);
};