function digits (value) {
  return value
    .toExponential()
    .replace(/e.*$/, '') // remove exponential notation
    .replace(/^0\.?0*|\./, '') // remove decimal point and leading zeros
    .length
}
Count the number of significant digits of a number.

For example:
  2.34 returns 3
  0.0034 returns 2
  120.5e+30 returns 4

@param {number} value
@return {number} digits   Number of significant digits