toggle-kit
Advanced tools
| import { FeatureFlag } from "../types/FeatureFlag"; | ||
| import { Property } from "../types/Property"; | ||
| export declare const isEnabled: <FlagNames>({ featureName, flags, property, }: { | ||
| export declare const isEnabled: <PropertyNames extends string, FlagNames>({ featureName, flags, property, }: { | ||
| featureName: FlagNames; | ||
| flags: Map<FlagNames, FeatureFlag<FlagNames>>; | ||
| property: Property; | ||
| flags: Map<FlagNames, FeatureFlag<PropertyNames, FlagNames>>; | ||
| property: Property<PropertyNames>; | ||
| }) => boolean; |
+3
-3
@@ -5,6 +5,6 @@ import { FeatureFlagClient } from "./types/FeatureFlagClient"; | ||
| import { Condition } from "./types/Condition"; | ||
| export declare function createFeatureFlagClient<FlagNames>({ property, flags: initialFlags, }: { | ||
| property: Property; | ||
| flags: FeatureFlag<FlagNames>[]; | ||
| export declare function createFeatureFlagClient<PropertyNames extends string, FlagNames>({ property, flags: initialFlags, }: { | ||
| property: Property<PropertyNames>; | ||
| flags: FeatureFlag<PropertyNames, FlagNames>[]; | ||
| }): FeatureFlagClient<FlagNames>; | ||
| export { type FeatureFlagClient, type Property, type FeatureFlag, type Condition, }; |
@@ -1,21 +0,21 @@ | ||
| export type Condition = { | ||
| export type Condition<PropertyNames> = { | ||
| type: "equal" | "contains" | "startsWith" | "endsWith"; | ||
| attribute: string; | ||
| attribute: PropertyNames; | ||
| expectedValue: string; | ||
| } | { | ||
| type: "equal" | "greaterThan" | "lessThan"; | ||
| attribute: string; | ||
| attribute: PropertyNames; | ||
| expectedValue: number; | ||
| } | { | ||
| type: "equal"; | ||
| attribute: string; | ||
| attribute: PropertyNames; | ||
| expectedValue: boolean; | ||
| } | { | ||
| type: "percentage"; | ||
| attribute: string; | ||
| attribute: PropertyNames; | ||
| expectedValue: number; | ||
| } | { | ||
| type: "regex"; | ||
| attribute: string; | ||
| attribute: PropertyNames; | ||
| expectedValue: RegExp; | ||
| }; |
| import { Condition } from "./Condition"; | ||
| export type FeatureFlag<FlagNames = {}> = { | ||
| export type FeatureFlag<PropertyNames = {}, FlagNames = {}> = { | ||
| name: FlagNames; | ||
| condition: Condition; | ||
| condition: Condition<PropertyNames>; | ||
| }; |
@@ -1,3 +0,1 @@ | ||
| export type Property = { | ||
| [key: string]: string | number | boolean; | ||
| }; | ||
| export type Property<PropertyNames extends string> = Record<PropertyNames, string | number | boolean>; |
+1
-1
| { | ||
| "name": "toggle-kit", | ||
| "version": "1.8.2", | ||
| "version": "1.9.0", | ||
| "description": "A feature flag library which runs fully on the service itself, without any dependencies.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
18338
1.29%288
-0.69%