Skip to content
FlagPilot
Menu

Node SDK

variation

Evaluate a flag of any type and get its value, or your default.

Evaluates the flag locally for the context and returns the value. Any failure (unknown flag, invalid context, malformed flag, no snapshot) returns defaultValue.

Use a typed helper when you know the flag’s type: it also guards against a flag whose type changed.

Signature
variation<T>(key: string, ctx: Context, defaultValue: T): T
Example
const theme = flags.variation('checkout-theme', { key: 'user-42' }, 'classic');

The SDK is @rollkit/sdk in the repository (packages/sdk). It is for server-side Node; browsers use a client key with the delivery API.