Skip to content

Commit

Permalink
fix: make exposing segment data backwards compatible (#575)
Browse files Browse the repository at this point in the history
* fix: make exposing segment data backwards compatible

* fix: make exposing segment data backwards compatible
  • Loading branch information
andreas-unleash committed Feb 1, 2024
1 parent 7c5406e commit 7a4d6d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function getFeatureToggleDefinition(toggleName: string) {
return instance && instance.getFeatureToggleDefinition(toggleName);
}

export function getFeatureToggleDefinitions(withFullSegments = false) {
return instance && instance.getFeatureToggleDefinitions(withFullSegments);
export function getFeatureToggleDefinitions(withFullSegments: boolean = false) {
return instance && instance.getFeatureToggleDefinitions(withFullSegments as any);
}

export function getVariant(
Expand Down
12 changes: 7 additions & 5 deletions src/unleash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,15 @@ export class Unleash extends EventEmitter {
return this.repository.getToggle(toggleName);
}

getFeatureToggleDefinitions(): Array<FeatureInterface>;
getFeatureToggleDefinitions(withFullSegments: true): Array<EnhancedFeatureInterface>;
getFeatureToggleDefinitions(
withFullSegments = false
withFullSegments?: any
): Array<FeatureInterface | EnhancedFeatureInterface> {
if (withFullSegments) {
return this.repository.getTogglesWithSegmentData();
}
return this.repository.getToggles();;
if (withFullSegments === true) {
return this.repository.getTogglesWithSegmentData();
}
return this.repository.getToggles();
}

count(toggleName: string, enabled: boolean) {
Expand Down

0 comments on commit 7a4d6d9

Please sign in to comment.