<commit_before>import React from 'react';
import styles from '../mixins/styles';

class Slider extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      perc: 0,
      value: 0
    };

    ['getProps', 'startSlide', 'endSlide', 'updateSlide', 'finishSlide',
    'disableAnimate', 'enableAnimate'].forEach((func) => {
      this[func] = this[func].bind(this);
    });
  }

  componentWillMount() {
    this.getProps(this.props);
  }

  componentWillReceiveProps(nextProps) {
    this.getProps(nextProps);
  }

  getProps(props) {
    this._step = isNaN(Math.abs(props.step)) ? 1 : Math.abs(props.step);
    var unit = (this._step).toString().split('.')[1];
    this._unit = unit ? unit.length : 0;
    this._min = props.min ? parseFloat(props.min).toFixed(this._unit) : 0;
    this._max = props.max ? parseFloat(props.max).toFixed(this._unit) : 100;
    this._sum = this._max - this._min;
    var value = props.value ? parseFloat(props.value).toFixed(this._unit) : 0;

    this._min = parseFloat(this._min);
    this._max = parseFloat(this._max);
    value = parseFloat(value);

    if (value <= this._min) {
      value = this._min;
    } else if (value > this._max) {
      value = this._max;
    }

    this.setState({
      perc: (value - this._min) / this._sum,
      value: value
    });
  }

  startSlide(e) {
    e.preventDefault();

    document.addEventListener('mousemove', this.updateSlide, false);
    document.addEventListener('mouseup', this.endSlide, false);
  }

  disableAnimate() {
    this.refs.track.classList.remove('animate');
    this.refs.thumb.classList.remove('animate');<commit_msg>fix min, max and value in slider<commit_after>import React from 'react';
import styles from '../mixins/styles';

class Slider extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      perc: 0,
      value: 0
    };

    ['getProps', 'startSlide', 'endSlide', 'updateSlide', 'finishSlide',
    'disableAnimate', 'enableAnimate'].forEach((func) => {
      this[func] = this[func].bind(this);
    });
  }

  componentWillMount() {
    this.getProps(this.props);
  }

  componentWillReceiveProps(nextProps) {
    this.getProps(nextProps);
  }

  getProps(props) {
    this._step = isNaN(Math.abs(props.step)) ? 1 : Math.abs(props.step);
    var unit = (this._step).toString().split('.')[1];
    this._unit = unit ? unit.length : 0;
    this._min = props.min !== undefined ? parseFloat(props.min).toFixed(this._unit) : 0;
    this._max = props.max !== undefined ? parseFloat(props.max).toFixed(this._unit) : 100;
    this._sum = this._max - this._min;
    var value = props.value !== undefined ? parseFloat(props.value).toFixed(this._unit) : 0;

    this._min = parseFloat(this._min);
    this._max = parseFloat(this._max);
    value = parseFloat(value);

    if (value <= this._min) {
      value = this._min;
    } else if (value > this._max) {
      value = this._max;
    }

    this.setState({
      perc: (value - this._min) / this._sum,
      value: value
    });
  }

  startSlide(e) {
    e.preventDefault();

    document.addEventListener('mousemove', this.updateSlide, false);
    document.addEventListener('mouseup', this.endSlide, false);
  }

  disableAnimate() {
    this.refs.track.classList.remove('animate');
    this.refs.thumb.classList.remove('animate');
{'fraction_non_alphanumeric': 0.16413011041480155, 'fraction_numerical': 0.005968367651447329, 'mean_word_length': 3.1230012300123002, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1517673', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1103, 'n_words': 198}