UNPKG

rheostat

Version:

Rheostat is a www, mobile, and accessible slider component built with React

20 lines (15 loc) 320 B
export default { getPosition(value, min, max) { return ((value - min) / (max - min)) * 100; }, getValue(pos, min, max) { const decimal = pos / 100; if (pos === 0) { return min; } if (pos === 100) { return max; } return Math.round(((max - min) * decimal) + min); }, };