UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

28 lines (27 loc) 1 kB
import type { FeatureFlags } from './types/feature-flags'; type BooleanFlags = Record<string, boolean>; type NormalizedFeatureFlags<ObjectFlags> = Partial<ObjectFlags & BooleanFlags>; /** * Normalise and filter a free Record<string, unknown> to match * the rules for feature flags in editor and renderer * * Input has to match to not be filtered output: * 1. cased in kebab-case (match [a-z-]) * 2. has any value * * Output matches * 1. cased in camelCase (match [a-zA-Z]) * 2. has boolean value or object {} value * * @param rawFeatureFlags */ export declare function normalizeFeatureFlags<ObjectFlags>(rawFeatureFlags?: Record<string, unknown>, options?: { objectFlagKeys: string[]; }): NormalizedFeatureFlags<ObjectFlags>; /** * Transforms FeatureFlags to a type safe string array of the enabled feature flags. * * Useful for analytics and analysis purposes. */ export declare function getEnabledFeatureFlagKeys(featureFlags: FeatureFlags): (keyof FeatureFlags)[]; export {};