code: function parseThresholds(thresholds = 0) {
      let result = thresholds;
  
      if (!Array.isArray(thresholds)) {
          result = [thresholds];
      } else if (!thresholds.length) {
          result = [0];
      }
  
      return result.map(threshold => {
          // We use Number function instead of parseFloat
          // to convert boolean values and null to theirs
          // numeric representation. This is done to act
          // in the same manner as a native implementation.
          threshold = Number(threshold);
  
          if (!window.isFinite(threshold)) {
              throw new TypeError('The provided double value is non-finite.');
          } else if (threshold < 0 || threshold > 1) {
              throw new RangeError('Threshold values must be between 0 and 1.');
          }
  
          return threshold;
      }).sort();
  }
docs: Validates and parses threshold values.
  Throws an error if one of the thresholds
  is non-finite or not in range of 0 and 1.
  
  @param {(Array<Number>|Number)} [thresholds = 0]
  @returns {Array<Number>} An array of thresholds in ascending order.