Skip to content

Commit

Permalink
bugfix: do not mutate original env vars object
Browse files Browse the repository at this point in the history
  • Loading branch information
lekkas committed May 31, 2016
1 parent bead6eb commit 383be09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils.coffee
Expand Up @@ -36,6 +36,8 @@ exports.mixpanelTrack = (event, properties = {}) ->
message: properties.error.message
stack: properties.error.stack

properties = _.cloneDeep(properties)

# Don't log private env vars (e.g. api keys)
if properties?.app?.env?
try
Expand All @@ -48,7 +50,7 @@ exports.mixpanelTrack = (event, properties = {}) ->

console.log('Event:', event, JSON.stringify(properties))
# Mutation is bad, and it should feel bad
properties = _.assign(_.cloneDeep(properties), mixpanelProperties)
properties = _.assign(properties, mixpanelProperties)

mixpanelClient.track(event, properties)

Expand Down

0 comments on commit 383be09

Please sign in to comment.