createFlagsCore
function createFlagsCore(options): FlagsCore;Defined in: core.ts:368
Construct the admin core over the configured storage.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
FlagsCoreOptions |
Returns
Section titled “Returns”Example
Section titled “Example”import { createFlagsCore } from "@xtandard/flags";import { createMemoryStorage } from "@xtandard/flags/storage/memory";
const storage = createMemoryStorage();const core = createFlagsCore({ sourceStorage: storage });
await core.upsertFlag({ key: "dark-mode", type: "boolean", enabled: true, defaultVariant: "off", variants: { on: { value: true }, off: { value: false } }, fallthrough: { variant: "off" },});
const snapshot = await core.publish({ message: "Enable dark-mode flag" });console.log(snapshot.version); // "v1"