SpeciesFileGroup/taxonworks

View on GitHub
app/javascript/vue/helpers/style.js

Summary

Maintainability
A
0 mins
Test Coverage
function convertToUnit (str, unit = 'px') {
  if (!Number(str) && !str) {
    return undefined
  } else if (isNaN(str)) {
    return String(str)
  } else {
    return `${Number(str)}${unit}`
  }
}

export {
  convertToUnit
}