tryParseHoursMinutesSecondsDefinition(text) {
    const colonIndex = text.indexOf(HourMinuteSecondSeparator);
    if (colonIndex === -1) {
      return null;
    }

    const definitionsArray = [];
    const hoursPart = text.slice(0, Math.max(0, colonIndex));
    // False positive of ESLint: Number.isNaN cannot recognize arbitrary text (e.g. "test") as NaN. So use direct isNaN.
    /* eslint-disable unicorn/prefer-number-properties */
    if (
      AnyValueUi !== hoursPart &&
      (isNaN(hoursPart) ||
        Number.parseInt(hoursPart, 10) < RecurrenceShifts.hours.minValue ||
        Number.parseInt(hoursPart, 10) > RecurrenceShifts.hours.maxValue)
    ) {
      return null;
    }

    let hoursValue;
    if (AnyValueUi === hoursPart) {
      hoursValue = AnyValueInt;
    } else {
      hoursValue = Number.parseInt(hoursPart, 10);
    }

    definitionsArray.push({ amount: hoursValue, shiftType: ShiftTypes.hours });

    const restPart = text.slice(Math.max(0, colonIndex + 1));
    const nextColonIndex = restPart.indexOf(HourMinuteSecondSeparator);
    if (nextColonIndex === -1) {
      if (
        AnyValueUi !== restPart &&
        (isNaN(restPart) ||
          Number.parseInt(restPart, 10) < RecurrenceShifts.minutes.minValue ||
          Number.parseInt(restPart, 10) > RecurrenceShifts.minutes.maxValue)
      ) {
        return null;
      }

      let minutesValue;
      if (AnyValueUi === restPart) {
        minutesValue = AnyValueInt;
      } else {
        minutesValue = Number.parseInt(restPart, 10);
      }

      definitionsArray.push({ amount: minutesValue, shiftType: ShiftTypes.minutes });
    } else {
      const minutesPart = restPart.slice(0, Math.max(0, nextColonIndex));
      if (
        AnyValueUi !== minutesPart &&
        (isNaN(minutesPart) ||
          Number.parseInt(minutesPart, 10) < RecurrenceShifts.minutes.minValue ||
          Number.parseInt(minutesPart, 10) > RecurrenceShifts.minutes.maxValue)
      ) {
        return null;
      }

      let minutesValue;
      if (AnyValueUi === minutesPart) {
        minutesValue = AnyValueInt;
      } else {
        minutesValue = Number.parseInt(minutesPart, 10);
      }

      definitionsArray.push({ amount: minutesValue, shiftType: ShiftTypes.minutes });

      const secondsPart = restPart.slice(Math.max(0, nextColonIndex + 1));
      if (
        AnyValueUi !== secondsPart &&
        (isNaN(secondsPart) ||
          Number.parseInt(secondsPart, 10) < RecurrenceShifts.seconds.minValue ||
          Number.parseInt(secondsPart, 10) > RecurrenceShifts.seconds.maxValue)
      ) {
        return null;
      }

      let secondsValue;
      if (AnyValueUi === secondsPart) {
        secondsValue = AnyValueInt;
      } else {
        secondsValue = Number.parseInt(secondsPart, 10);
      }

      definitionsArray.push({ amount: secondsValue, shiftType: ShiftTypes.seconds });
    }
    /* eslint-enable unicorn/prefer-number-properties */

    return definitionsArray;
  }
/**
   * Tries to parse a hours:minutes:seconds definition from text. The text is expected to be like "14:45:00".
   * "Any" value is supported in place of every part.
   * @param  {string}          text the text to parse
   * @return {(Array | null)}       array of objects containing the shift type and amount, or null if unsuccessful
   */
Tries to parse a hours:minutes:seconds definition from text. The text is expected to be like "14:45:00".
"Any" value is supported in place of every part.
@param  {string}          text the text to parse
@return {(Array | null)}       array of objects containing the shift type and amount, or null if unsuccessful
Tries to parse a hours : minutes : seconds definition from text . The text is expected to be like " 14 : 45 : 00 " . " Any " value is supported in place of every part . @param { string } text the text to parse @return { ( Array | null ) } array of objects containing the shift type and amount or null if unsuccessful
tryParseHoursMinutesSecondsDefinition(text) {
    const colonIndex = text.indexOf(HourMinuteSecondSeparator);
    if (colonIndex === -1) {
      return null;
    }
    const definitionsArray = [];
    const hoursPart = text.slice(0, Math.max(0, colonIndex));
    if (
      AnyValueUi !== hoursPart &&
      (isNaN(hoursPart) ||
        Number.parseInt(hoursPart, 10) < RecurrenceShifts.hours.minValue ||
        Number.parseInt(hoursPart, 10) > RecurrenceShifts.hours.maxValue)
    ) {
      return null;
    }
    let hoursValue;
    if (AnyValueUi === hoursPart) {
      hoursValue = AnyValueInt;
    } else {
      hoursValue = Number.parseInt(hoursPart, 10);
    }
    definitionsArray.push({ amount: hoursValue, shiftType: ShiftTypes.hours });
    const restPart = text.slice(Math.max(0, colonIndex + 1));
    const nextColonIndex = restPart.indexOf(HourMinuteSecondSeparator);
    if (nextColonIndex === -1) {
      if (
        AnyValueUi !== restPart &&
        (isNaN(restPart) ||
          Number.parseInt(restPart, 10) < RecurrenceShifts.minutes.minValue ||
          Number.parseInt(restPart, 10) > RecurrenceShifts.minutes.maxValue)
      ) {
        return null;
      }
      let minutesValue;
      if (AnyValueUi === restPart) {
        minutesValue = AnyValueInt;
      } else {
        minutesValue = Number.parseInt(restPart, 10);
      }
      definitionsArray.push({ amount: minutesValue, shiftType: ShiftTypes.minutes });
    } else {
      const minutesPart = restPart.slice(0, Math.max(0, nextColonIndex));
      if (
        AnyValueUi !== minutesPart &&
        (isNaN(minutesPart) ||
          Number.parseInt(minutesPart, 10) < RecurrenceShifts.minutes.minValue ||
          Number.parseInt(minutesPart, 10) > RecurrenceShifts.minutes.maxValue)
      ) {
        return null;
      }
      let minutesValue;
      if (AnyValueUi === minutesPart) {
        minutesValue = AnyValueInt;
      } else {
        minutesValue = Number.parseInt(minutesPart, 10);
      }
      definitionsArray.push({ amount: minutesValue, shiftType: ShiftTypes.minutes });
      const secondsPart = restPart.slice(Math.max(0, nextColonIndex + 1));
      if (
        AnyValueUi !== secondsPart &&
        (isNaN(secondsPart) ||
          Number.parseInt(secondsPart, 10) < RecurrenceShifts.seconds.minValue ||
          Number.parseInt(secondsPart, 10) > RecurrenceShifts.seconds.maxValue)
      ) {
        return null;
      }
      let secondsValue;
      if (AnyValueUi === secondsPart) {
        secondsValue = AnyValueInt;
      } else {
        secondsValue = Number.parseInt(secondsPart, 10);
      }
      definitionsArray.push({ amount: secondsValue, shiftType: ShiftTypes.seconds });
    }
    return definitionsArray;
  }
tryParseHoursMinutesSecondsDefinition ( text ) { const colonIndex = text . indexOf ( HourMinuteSecondSeparator ) ; if ( colonIndex === - 1 ) { return null ; } const definitionsArray = [ ] ; const hoursPart = text . slice ( 0 , Math . max ( 0 , colonIndex ) ) ; if ( AnyValueUi !== hoursPart && ( isNaN ( hoursPart ) || Number . parseInt ( hoursPart , 10 ) < RecurrenceShifts . hours . minValue || Number . parseInt ( hoursPart , 10 ) > RecurrenceShifts . hours . maxValue ) ) { return null ; } let hoursValue ; if ( AnyValueUi === hoursPart ) { hoursValue = AnyValueInt ; } else { hoursValue = Number . parseInt ( hoursPart , 10 ) ; } definitionsArray . push ( { amount : hoursValue , shiftType : ShiftTypes . hours } ) ; const restPart = text . slice ( Math . max ( 0 , colonIndex + 1 ) ) ; const nextColonIndex = restPart . indexOf ( HourMinuteSecondSeparator ) ; if ( nextColonIndex === - 1 ) { if ( AnyValueUi !== restPart && ( isNaN ( restPart ) || Number . parseInt ( restPart , 10 ) < RecurrenceShifts . minutes . minValue || Number . parseInt ( restPart , 10 ) > RecurrenceShifts . minutes . maxValue ) ) { return null ; } let minutesValue ; if ( AnyValueUi === restPart ) { minutesValue = AnyValueInt ; } else { minutesValue = Number . parseInt ( restPart , 10 ) ; } definitionsArray . push ( { amount : minutesValue , shiftType : ShiftTypes . minutes } ) ; } else { const minutesPart = restPart . slice ( 0 , Math . max ( 0 , nextColonIndex ) ) ; if ( AnyValueUi !== minutesPart && ( isNaN ( minutesPart ) || Number . parseInt ( minutesPart , 10 ) < RecurrenceShifts . minutes . minValue || Number . parseInt ( minutesPart , 10 ) > RecurrenceShifts . minutes . maxValue ) ) { return null ; } let minutesValue ; if ( AnyValueUi === minutesPart ) { minutesValue = AnyValueInt ; } else { minutesValue = Number . parseInt ( minutesPart , 10 ) ; } definitionsArray . push ( { amount : minutesValue , shiftType : ShiftTypes . minutes } ) ; const secondsPart = restPart . slice ( Math . max ( 0 , nextColonIndex + 1 ) ) ; if ( AnyValueUi !== secondsPart && ( isNaN ( secondsPart ) || Number . parseInt ( secondsPart , 10 ) < RecurrenceShifts . seconds . minValue || Number . parseInt ( secondsPart , 10 ) > RecurrenceShifts . seconds . maxValue ) ) { return null ; } let secondsValue ; if ( AnyValueUi === secondsPart ) { secondsValue = AnyValueInt ; } else { secondsValue = Number . parseInt ( secondsPart , 10 ) ; } definitionsArray . push ( { amount : secondsValue , shiftType : ShiftTypes . seconds } ) ; } return definitionsArray ; }
Tries to parse a hours:minutes:seconds definition from text.
Tries to parse a hours : minutes : seconds definition from text .
// False positive of ESLint: Number.isNaN cannot recognize arbitrary text (e.g. "test") as NaN. So use direct isNaN. /* eslint-disable unicorn/prefer-number-properties */ /* eslint-enable unicorn/prefer-number-properties */