AdonisJS API
    Preparing search index...

    Class FeatureFlags<FlagsList>

    A light weight implementation of feature flags to conditionally enable experimental and legacy features.

    const flags = new FeatureFlags({ newUI: true, betaFeature: false })
    if (flags.enabled('newUI')) {
    // Enable new UI
    }
    const dynamicFlags = new FeatureFlags(() => getConfigFlags())
    flags.when('betaFeature',
    () => console.log('Beta enabled'),
    () => console.log('Beta disabled')
    )

    Type Parameters

    • FlagsList extends Record<any, any>

      Type definition for the feature flags object

    Index
    • Checks if a feature is enabled

      Type Parameters

      • Feature extends string | number | symbol | string & {}

      Parameters

      • feature: Feature

        The feature name to check

      Returns boolean

      boolean - True if the feature is enabled

    • Checks if a feature is disabled

      Type Parameters

      • Feature extends string | number | symbol | string & {}

      Parameters

      • feature: Feature

        The feature name to check

      Returns boolean

      boolean - True if the feature is disabled

    • Checks if a feature exists in the flags

      Type Parameters

      • Feature extends string | number | symbol | string & {}

      Parameters

      • feature: Feature

        The feature name to check

      Returns boolean

      boolean - True if the feature exists