CyclicMaterials/atom-range-behavior

View on GitHub
src/RangeBehavior/clampedValue.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * @fileoverview Clamped value for RangeBehavior
 * @author Frederik Krautwald
 * @copyright 2015 Cyclic Materials. All rights reserved.
 */
import stepCalc from './stepCalc'

function clampedValue({value, step, min, max}) {
  return Math.min(max, Math.max(min, stepCalc({value, step, min})))
}

export default clampedValue