A builder for feature flag configurations to be used with TestData.

Hierarchy

  • TestDataFlagBuilder

Constructors

Properties

_data: BuilderData = ...
_key: string

Accessors

Methods

  • Specifies the fallthrough variation for a flag. The fallthrough is the value that is returned if targeting is on and the user was not matched by a more specific target or rule.

    If a boolean is supplied, and the flag was previously configured with other variations, this also changes it to a boolean flag.

    Parameters

    • variation: number | boolean

      either true or false or the index of the desired fallthrough variation: 0 for the first, 1 for the second, etc.

    Returns TestDataFlagBuilder

    the flag builder

  • Sets the flag to always return the specified variation for all contexts.

    Targeting is switched on, any existing targets or rules are removed, and the fallthrough variation is set to the specified value. The off variation is left unchanged.

    If a boolean is supplied, and the flag was previously configured with other variations, this also changes it to a boolean flag.

    Parameters

    • variation: number | boolean

    Returns TestDataFlagBuilder

    the flag builder

  • Sets the flag to return the specified variation for a specific context key when targeting is on.

    This has no effect when targeting is turned off for the flag.

    If the variation is a boolean value and the flag was not already a boolean flag, this also changes it to be a boolean flag.

    If the variation is an integer, it specifies a variation out of whatever variation values have already been defined.

    Parameters

    • contextKind: string

      a context kind

    • contextKey: string

      a context key

    • variation: number | boolean

      either true or false or the index of the desired variation: 0 for the first, 1 for the second, etc.

    Returns TestDataFlagBuilder

    the flag builder

  • Sets the flag to return the specified variation for a specific context key when targeting is on. The context kind for contexts created with this method will be 'user'.

    This has no effect when targeting is turned off for the flag.

    If the variation is a boolean value and the flag was not already a boolean flag, this also changes it to be a boolean flag.

    If the variation is an integer, it specifies a variation out of whatever variation values have already been defined.

    Parameters

    • contextKey: string

      a context key

    • variation: number | boolean

      either true or false or the index of the desired variation: 0 for the first, 1 for the second, etc.

    Returns TestDataFlagBuilder

    the flag builder

Generated using TypeDoc