mirror of
https://github.com/vercel/flags.git
synced 2026-09-19 03:49:23 +08:00
422435c0eb
* @vercel-flags » flags * update lockfile * fix name
23 lines
573 B
TypeScript
23 lines
573 B
TypeScript
import { flag } from 'flags/next';
|
|
|
|
export const exampleFlag = flag<boolean>({
|
|
key: 'example-flag',
|
|
decide: () => true,
|
|
defaultValue: false,
|
|
options: [false, true],
|
|
});
|
|
|
|
export const hostFlag = flag<string>({
|
|
key: 'host',
|
|
decide: ({ headers }) => headers.get('host') || 'no host',
|
|
options: ['no host', 'localhost'],
|
|
});
|
|
|
|
export const cookieFlag = flag<string>({
|
|
key: 'cookie',
|
|
decide: ({ cookies }) => cookies.get('example-cookie')?.value || 'no cookie',
|
|
options: ['no cookie'],
|
|
});
|
|
|
|
export const precomputedFlags = [exampleFlag, hostFlag, cookieFlag];
|