pxToNumber.js 197 B

123456
  1. export function pxToNumber(value) {
  2. if (!value) return 0
  3. if (typeof value === 'number') return value
  4. const match = value.match(/^\d*(\.\d*)?/)
  5. return match ? Number(match[0]) : 0
  6. }