index.js
function convertUnit(str) {
  const reg = /\.\d*/;
  const result = reg.exec(str);
  if (result && result[0]) {
    return {
      precision: result[0].length - 1,
      unit: str.substring(result[0].length + 1),
    };
  }
  return {
    unit: str,
  };
}
function convertUnit(str) {
  const reg = /\.\d*/;
  const result = reg.exec(str);
  if (result && result[0]) {
    return {
      precision: result[0].length - 1,
      unit: str.substring(result[0].length + 1),
    };
  }
  return {
    unit: str,
  };
}
function convertUnit ( str ) { const reg = / \.\d* / ; const result = reg . exec ( str ) ; if ( result && result [ 0 ] ) { return { precision : result [ 0 ] . length - 1 , unit : str . substring ( result [ 0 ] . length + 1 ) , } ; } return { unit : str , } ; }
Convert the unit info
@param {String} str The unit info
@returns {Object} The format unit info
Convert the unit info