get-all-enabled-feature-toggle-name-keys

A function that gets all enabled and configurable features for the parent entity of the currently logged-in user. You can also get only the name of the features or a specific feature.

Installation#

npm install @iqmetrix/get-all-enabled-feature-toggle-name-keys

Interface#

interface Feature {
AllowConfiguration: boolean;
Description: string;
Detail: null | string;
EntityId: number;
FeatureId: number;
GuidKey: string;
Name: string;
NameKey: string;
Toggle: boolean;
SubFeatures: Array<Feature>;
}
const getAllEnabledFeatureToggleNameKeys: () => Promise<String[]>;
const getAllEnabledFeatureToggle: () => Promise<Feature[]>;
const getFeatureToggleById: (featureId: number) => Promise<Feature>;

Example#

import getAllEnabledFeatureToggleNameKeys from '@iqmetrix/get-all-enabled-feature-toggle-name-keys';
getAllEnabledFeatureToggleNameKeys()
.then(enabledFeatures => enabledFeatures.forEach(featureNameKey=> console.log(featureNameKey)))
.catch(console.error)
import { getAllEnabledFeatureToggle, getFeatureToggleById } from '@iqmetrix/get-all-enabled-feature-toggle-name-keys';
getAllEnabledFeatureToggle()
.then(enabledFeatures => enabledFeatures.forEach(feature=> console.log(feature)))
.catch(console.error)
getFeatureToggleById(12345)
.then(feature => console.log(feature))
.catch(console.error)

See tests for more examples.

Sources#

Last updated on by Paulo Andrade