{"size": 285, "ext": "js", "max_stars_repo_path": "src/universal/util/roundByIncrement.js", "max_stars_repo_name": "jcoreio/iron-pi-webapp", "max_stars_repo_stars_event_min_datetime": "2018-04-11T21:57:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-09T00:03:04.000Z", "max_issues_repo_path": "src/universal/util/roundByIncrement.js", "max_issues_repo_name": "jcoreio/iron-pi-webapp", "max_issues_repo_issues_event_min_datetime": "2018-08-05T04:02:59.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-08T22:40:26.000Z", "max_forks_repo_path": "src/universal/util/roundByIncrement.js", "max_forks_repo_name": "jcoreio/iron-pi-webapp", "max_forks_repo_forks_event_min_datetime": "2018-08-13T12:35:02.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-13T12:35:02.000Z"}
{"max_stars_count": 3, "max_issues_count": 21, "max_forks_count": 1, "avg_line_length": 25.9090909091, "max_line_length": 84, "alphanum_fraction": 0.6421052632}
// @flow

export default function roundByIncrement(value: number, rounding: ?number): number {
  if (rounding && rounding > 0) {
    const prefloor = value >= 0 ? value + rounding / 2 : value - rounding / 2
    return prefloor - (prefloor % rounding)
  } else {
    return value
  }
}
