How to use the @optimizely/js-sdk-utils.keyBy function in @optimizely/js-sdk-utils

To help you get started, we’ve selected a few @optimizely/js-sdk-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github optimizely / javascript-sdk / packages / models / src / models.ts View on Github external
// these must be constructed separately
    variations: Variation[]
    group?: Group
  }) {
    this._id = id
    this._status = status
    this._key = key
    this._layerId = layerId
    this._audienceIds = audienceIds
    this._variations = variations
    this._forcedVariations = forcedVariations
    this._group = group

    this.trafficAllocation = new OptimizelyTrafficAllocation({
      allocations: trafficAllocation,
      entityIdMap: keyBy(variations, variation => variation.id),
    })
  }