Backstage
    Preparing search index...

    Function readDurationFromConfig

    • Reads a duration from config.

      Parameters

      • config: Config

        A configuration object

      • Optionaloptions: { key?: string }

      Returns HumanDuration

      A duration object

      The supported formats are:

      • A string in the format of '1d', '2 seconds' etc. as supported by the ms library.
      • A standard ISO formatted duration string, e.g. 'P2DT6H' or 'PT1M'.
      • An object with individual units (in plural) as keys, e.g. { days: 2, hours: 6 }.

      The string forms are naturally only supported if the options.key argument is passed, since a Config argument always represents an object by its nature.

      This does not support optionality; if you want to support optional durations, you need to first check the presence of the target with config.has(...) and then call this function.