src/lib/index.js
function round (value, rules) {
  let unit = 1.0, roundOp = Math.round;

  if (rules) {
    roundOp = Math[rules.type === 'top' ? 'floor' : 'ceil'];
    if ('object' === typeof rules.grow) {
      unit = rules.grow[rules.type] || 1.0;
    }
  }

  return roundOp(value / unit) * unit;
}
function round (value, rules) {
  let unit = 1.0, roundOp = Math.round;

  if (rules) {
    roundOp = Math[rules.type === 'top' ? 'floor' : 'ceil'];
    if ('object' === typeof rules.grow) {
      unit = rules.grow[rules.type] || 1.0;
    }
  }

  return roundOp(value / unit) * unit;
}
function round ( value , rules ) { let unit = 1.0 , roundOp = Math . round ; if ( rules ) { roundOp = Math [ rules . type === 'top' ? 'floor' : 'ceil' ] ; if ( 'object' === typeof rules . grow ) { unit = rules . grow [ rules . type ] || 1.0 ; } } return roundOp ( value / unit ) * unit ; }
Round a number to nearest multiple according to rules.
Default multiple is 1.0. Supply nearest multiple in rules.grow parameter.

Rounding rules:
type === 'top' then use floor rounding.
otherwise, use ceiling rounding.

@param {Number} value - The raw value to round.
@param {Object} [rules] - Rounding rules. If omitted, just uses Math.round.
If supplied, must at least specify rules.type.
@param {String} [rules.type] - Can be one of 'top', 'width', or 'height'.
@param {Object} [rules.grow] - Options that control padding adjustments.
@param {Number} [rules.grow.top] - Nearest multiple to grow to. Used if
matches given type parameter.
@param {Number} [rules.grow.width] - Nearest multiple to grow to. Used if
matches given type parameter.
@param {Number} [rules.grow.height] - Nearest multiple to grow to. Used if
matches given type parameter.
@returns {Number} The rounded value according to rules derived from type and
grow.
Round a number to nearest multiple according to rules . Default multiple is 1 . 0 . Supply nearest multiple in rules . grow parameter .