forked from launchdarkly/node-server-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prepare 5.3.0 release (launchdarkly#113)
- Loading branch information
1 parent
2a5e6c7
commit 62903ce
Showing
7 changed files
with
219 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
function FlagsStateBuilder(valid) { | ||
var builder = {}; | ||
var flagValues = {}; | ||
var flagMetadata = {}; | ||
|
||
builder.addFlag = function(flag, value, variation) { | ||
flagValues[flag.key] = value; | ||
var meta = { | ||
version: flag.version, | ||
trackEvents: flag.trackEvents | ||
}; | ||
if (variation !== undefined && variation !== null) { | ||
meta.variation = variation; | ||
} | ||
if (flag.debugEventsUntilDate !== undefined && flag.debugEventsUntilDate !== null) { | ||
meta.debugEventsUntilDate = flag.debugEventsUntilDate; | ||
} | ||
flagMetadata[flag.key] = meta; | ||
}; | ||
|
||
builder.build = function() { | ||
return { | ||
valid: valid, | ||
allValues: function() { return flagValues; }, | ||
getFlagValue: function(key) { return flagValues[key]; }, | ||
toJSON: function() { | ||
return Object.assign({}, flagValues, { $flagsState: flagMetadata, $valid: valid }); | ||
} | ||
}; | ||
} | ||
|
||
return builder; | ||
} | ||
|
||
module.exports = FlagsStateBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters