<commit_before>'use strict';

import noUiSlider from 'nouislider'
import wNumb from 'wnumb'
import { getOrdinal } from '../helpers'

export default function Slider() {

	console.log("-- Slider initialized")

  $('.Slider').each(function(){

    let slider = this
		let $slider = $(slider)
		let $control = $slider.find('.Slider__control')
		let $value = $slider.find('.Slider__value')
		let $input = $slider.find('input[type=hidden]')

		// Get ths config for this component
		let config = $control.data('config')

		// Create the slider
    noUiSlider.create($control[0], {
      start: config.start,
      connect: config.connect,
      step: config.step,
      format: {
	      to: ( value ) => {
					return parseInt(value)
	      },
	      from: ( value ) => {
	        return parseInt(value)
	      }
	    },
      range: config.range
		})
		
		// Set the initial value, as per the hidden element
		$control[0].noUiSlider.set($input.val())

		// On slide update, set the value of the nexted hidden input
    $control[0].noUiSlider.on('update', (values, handle) => {

			// if two values, output a range
			let value0, value1, valueString

			if (values.length == 2) {

				value0 = values[0]
				value1 = values[1]

				// Should this be ordinal?
				if (config.unit == 'ordinal'){
					value0 = getOrdinal(value0)
					value1 = getOrdinal(value1)
				} else if (config.unit) {
					value0 = `${value0}`
					value1 = `${value1} ${config.unit}`
				}

				valueString = `${value0} — ${value1}`


			} else {

				value0 = values[0]

				// Should this be ordinal?
				if (config.unit == 'ordinal'){
					value0 = getOrdinal(value0)
				} else if (config.unit) {
					value0 = `${value0} ${config.unit}`
				}

				valueString = `${value0}`

			}

			// Set the value of the hidden input
			$input.val(values)

			// Set the html in the value container
			$value.html(valueString)

    })

  })

}
<commit_msg>Don’t animate the slider<commit_after>'use strict';

import noUiSlider from 'nouislider'
import wNumb from 'wnumb'
import { getOrdinal } from '../helpers'

export default function Slider() {

	console.log("-- Slider initialized")

  $('.Slider').each(function(){

    let slider = this
		let $slider = $(slider)
		let $control = $slider.find('.Slider__control')
		let $value = $slider.find('.Slider__value')
		let $input = $slider.find('input[type=hidden]')

		// Get ths config for this component
		let config = $control.data('config')

		// Create the slider
    noUiSlider.create($control[0], {
      start: config.start,
			connect: config.connect,
			animate: false,
      step: config.step,
      format: {
	      to: ( value ) => {
					return parseInt(value)
	      },
	      from: ( value ) => {
	        return parseInt(value)
	      }
	    },
      range: config.range
		})
		
		// Set the initial value, as per the hidden element
		$control[0].noUiSlider.set($input.val())

		// On slide update, set the value of the nexted hidden input
    $control[0].noUiSlider.on('update', (values, handle) => {

			// if two values, output a range
			let value0, value1, valueString

			if (values.length == 2) {

				value0 = values[0]
				value1 = values[1]

				// Should this be ordinal?
				if (config.unit == 'ordinal'){
					value0 = getOrdinal(value0)
					value1 = getOrdinal(value1)
				} else if (config.unit) {
					value0 = `${value0}`
					value1 = `${value1} ${config.unit}`
				}

				valueString = `${value0} — ${value1}`


			} else {

				value0 = values[0]

				// Should this be ordinal?
				if (config.unit == 'ordinal'){
					value0 = getOrdinal(value0)
				} else if (config.unit) {
					value0 = `${value0} ${config.unit}`
				}

				valueString = `${value0}`

			}

			// Set the value of the hidden input
			$input.val(values)

			// Set the html in the value container
			$value.html(valueString)

    })

  })

}

{'fraction_non_alphanumeric': 0.1480425200933368, 'fraction_numerical': 0.014000518537723619, 'mean_word_length': 2.5855018587360594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5614665', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1271, 'n_words': 339}