"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parsePx = parsePx;
/**
 * Util for converting a css pixel size value to a number (of pixels).
 *
 * ie.
 * ```ts
 * const pixels = parsePx('10px')
 * //    ^$ const pixels: number
 * ```
 * * ```ts
 * const pixels = parsePx('10')
 * //    ^$ const pixels: number | undefined
 * ```
 */
// At time of writting prettier would strip the extend here.
// prettier-ignore

// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports

// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
function parsePx(pxStr) {
  if (!pxStr.endsWith('px')) {
    return undefined;
  }
  var maybeNumber = parseInt(pxStr, 10);
  return !Number.isNaN(maybeNumber) ? maybeNumber : undefined;
}