mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
Signed-off-by: Wes <wesbillman@users.noreply.github.com> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
20 lines
692 B
TypeScript
20 lines
692 B
TypeScript
/**
|
|
* Pure resolution logic for preview-feature visibility.
|
|
* No side effects, no imports — safe to test in isolation.
|
|
*
|
|
* The manifest (`preview-features.json`) lists only preview features.
|
|
* Anything not in the manifest is stable and resolves true elsewhere
|
|
* (see `useFeatureEnabled`). Once you're inside `resolveEnabled`, the
|
|
* feature IS in the manifest — preview by definition.
|
|
*
|
|
* An explicit user override wins; otherwise the feature's manifest default is
|
|
* used (false when omitted).
|
|
*/
|
|
export function resolveEnabled(
|
|
featureId: string,
|
|
overrides: Record<string, boolean>,
|
|
defaultEnabled = false,
|
|
): boolean {
|
|
return overrides[featureId] ?? defaultEnabled;
|
|
}
|