<commit_before>// Copyright 2014-2018, University of Colorado Boulder

/**
 * WavelengthSpectrumNode displays a rectangle of the visible spectrum.
 *
 * @author <NAME> (PixelZoom, Inc.)
 * @author <NAME> (PhET Interactive Simulations)
 */
define( function( require ) {
  'use strict';

  // modules
  var inherit = require( 'PHET_CORE/inherit' );
  var sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' );
  var SpectrumNode = require( 'SCENERY_PHET/SpectrumNode' );
  var Tandem = require( 'TANDEM/Tandem' );
  var VisibleColor = require( 'SCENERY_PHET/VisibleColor' );

  /**
   * Slider track that displays the visible spectrum of light.
   *
   * @param {Object} [options]
   * @constructor
   */
  function WavelengthSpectrumNode( options ) {

    options = _.extend( {
      minWavelength: VisibleColor.MIN_WAVELENGTH,
      maxWavelength: VisibleColor.MAX_WAVELENGTH,
      tandem: Tandem.optional
    }, options );

    // validation
    assert && assert( options.minWavelength < options.maxWavelength );
    assert && assert( options.minWavelength >= VisibleColor.MIN_WAVELENGTH && options.minWavelength <= VisibleColor.MAX_WAVELENGTH );
    assert && assert( options.maxWavelength >= VisibleColor.MIN_WAVELENGTH && options.maxWavelength <= VisibleColor.MAX_WAVELENGTH );
    assert && assert( typeof options.minValue === 'undefined', 'minValue is supplied by WavelengthSlider' );
    assert && assert( typeof options.maxValue === 'undefined', 'maxValue is supplied by WavelengthSlider' );

    options.minValue = options.minWavelength;
    options.maxValue = options.maxWavelength;
    options.valueToColor = function( value ) {
      return VisibleColor.wavelengthToColor( value );
    };

    SpectrumNode.call( this, options );
  }

  sceneryPhet.register( 'WavelengthSpectrumNode', WavelengthSpectrumNode );

  return inherit( SpectrumNode, WavelengthSpectrumNode );
} );<commit_msg>convert WavelengthSpectrumNode to ES6 class, #501<commit_after>// Copyright 2014-2019, University of Colorado Boulder

/**
 * WavelengthSpectrumNode displays a rectangle of the visible spectrum.
 *
 * @author <NAME> (PixelZoom, Inc.)
 * @author <NAME> (PhET Interactive Simulations)
 */
define( function( require ) {
  'use strict';

  // modules
  const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' );
  const SpectrumNode = require( 'SCENERY_PHET/SpectrumNode' );
  const Tandem = require( 'TANDEM/Tandem' );
  const VisibleColor = require( 'SCENERY_PHET/VisibleColor' );

  /**
   * Slider track that displays the visible spectrum of light.
   *
   * @param {Object} [options]
   * @constructor
   */
  class WavelengthSpectrumNode extends SpectrumNode {

    constructor( options ) {

      options = _.extend( {
        valueToColor: value => VisibleColor.wavelengthToColor( value ),
        minWavelength: VisibleColor.MIN_WAVELENGTH,
        maxWavelength: VisibleColor.MAX_WAVELENGTH,
        tandem: Tandem.optional
      }, options );

      // validation
      assert && assert( options.minWavelength < options.maxWavelength );
      assert && assert( options.minWavelength >= VisibleColor.MIN_WAVELENGTH && options.minWavelength <= VisibleColor.MAX_WAVELENGTH );
      assert && assert( options.maxWavelength >= VisibleColor.MIN_WAVELENGTH && options.maxWavelength <= VisibleColor.MAX_WAVELENGTH );
      assert && assert( typeof options.minValue === 'undefined', 'minValue is supplied by WavelengthSlider' );
      assert && assert( typeof options.maxValue === 'undefined', 'maxValue is supplied by WavelengthSlider' );

      options.minValue = options.minWavelength;
      options.maxValue = options.maxWavelength;

      super( options );
    }
  }

  return sceneryPhet.register( 'WavelengthSpectrumNode', WavelengthSpectrumNode );
} );
{'fraction_non_alphanumeric': 0.11105193075898802, 'fraction_numerical': 0.005326231691078562, 'mean_word_length': 3.99468085106383, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 12, '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': '3716938', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1113, 'n_words': 262}