Skip to content

Commit

Permalink
Merge pull request #50 from HubSpot/prevent_interpreter_from_mutating…
Browse files Browse the repository at this point in the history
…_serialization_object

Prevent the interpreter from mutating the serialization object
  • Loading branch information
mattrheault authored Feb 17, 2017
2 parents 7d76eca + 8bab131 commit 98d50a3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "planout",
"main": "dist/planout.js",
"version": "3.0.0",
"version": "3.0.2",
"homepage": "https://www.github.com/HubSpot/PlanOut.js",
"author": "Guy Aridor <[email protected]>",
"description": "A JavaScript port of Facebook's PlanOut Experimentation Framework",
Expand Down
2 changes: 1 addition & 1 deletion dist/planout.js
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ return /******/ (function(modules) { // webpackBootstrap

_classCallCheck(this, Interpreter);

this._serialization = serialization;
this._serialization = (0, _utils2.deepCopy)(serialization);
if (!environment) {
this._env = new _assignment2.default(experimentSalt);
} else {
Expand Down
6 changes: 3 additions & 3 deletions dist/planout.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planout_core_compatible.js
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ return /******/ (function(modules) { // webpackBootstrap

_classCallCheck(this, Interpreter);

this._serialization = serialization;
this._serialization = (0, _utils2.deepCopy)(serialization);
if (!environment) {
this._env = new _assignment2.default(experimentSalt);
} else {
Expand Down
6 changes: 3 additions & 3 deletions dist/planout_core_compatible.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions es6/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { shallowCopy, deepCopy, isObject, isArray, map } from "./lib/utils";

class Interpreter {
constructor(serialization, experimentSalt='global_salt', inputs={}, environment) {
this._serialization = serialization;
this._serialization = deepCopy(serialization);
if (!environment) {
this._env = new Assignment(experimentSalt);
} else {
Expand Down Expand Up @@ -35,7 +35,7 @@ class Interpreter {
inputVal = defaultVal;
}
var envVal = this._env.get(name);
if (envVal !== undefined && envVal !== null) {
if (envVal !== undefined && envVal !== null) {
return envVal;
}
return inputVal;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "planout",
"version": "3.0.1",
"version": "3.0.2",
"dependencies": {
"sha1": "1.1.0",
"bignumber.js": "2.0.7"
Expand Down

0 comments on commit 98d50a3

Please sign in to comment.