MCPcopy Index your code
hub / github.com/WebDevSimplified/feature-flags-sample-code / canViewFeature

Function canViewFeature

src/lib/featureFlags.ts:27–31  ·  view source on GitHub ↗
(featureName: FeatureFlagName, user: User)

Source from the content-addressed store, hash-verified

25} as const satisfies Record<string, FeatureFlagRule[] | boolean>
26
27export function canViewFeature(featureName: FeatureFlagName, user: User) {
28 const rules = FEATURE_FLAGS[featureName]
29 if (typeof rules === "boolean") return rules
30 return rules.some(rule => checkRule(rule, featureName, user))
31}
32
33function checkRule(
34 { userRoles, percentageOfUsers }: FeatureFlagRule,

Callers 2

FeatureEnabledFunction · 0.90
getProductsFunction · 0.90

Calls 1

checkRuleFunction · 0.85

Tested by

no test coverage detected