fc-react-slider
Version:
A fully featured slider component made in React
22 lines (18 loc) • 804 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = function (props, value, position) {
if (position) return position <= props.trackLength;
var min = props.min,
max = props.max,
step = props.step;
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
// if Array
return value[1] - value[0] >= step && value[0] >= min && value[1] <= max;
} else {
// TODO : is step needed here ?
return value >= min && value <= max;
}
};