Skip to content

Commit 98d50a3

Browse files
authored
Merge pull request #50 from HubSpot/prevent_interpreter_from_mutating_serialization_object
Prevent the interpreter from mutating the serialization object
2 parents 7d76eca + 8bab131 commit 98d50a3

7 files changed

+12
-12
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "planout",
33
"main": "dist/planout.js",
4-
"version": "3.0.0",
4+
"version": "3.0.2",
55
"homepage": "https://www.github.com/HubSpot/PlanOut.js",
66
"author": "Guy Aridor <[email protected]>",
77
"description": "A JavaScript port of Facebook's PlanOut Experimentation Framework",

dist/planout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ return /******/ (function(modules) { // webpackBootstrap
16431643

16441644
_classCallCheck(this, Interpreter);
16451645

1646-
this._serialization = serialization;
1646+
this._serialization = (0, _utils2.deepCopy)(serialization);
16471647
if (!environment) {
16481648
this._env = new _assignment2.default(experimentSalt);
16491649
} else {

dist/planout.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/planout_core_compatible.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ return /******/ (function(modules) { // webpackBootstrap
16431643

16441644
_classCallCheck(this, Interpreter);
16451645

1646-
this._serialization = serialization;
1646+
this._serialization = (0, _utils2.deepCopy)(serialization);
16471647
if (!environment) {
16481648
this._env = new _assignment2.default(experimentSalt);
16491649
} else {

dist/planout_core_compatible.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

es6/interpreter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { shallowCopy, deepCopy, isObject, isArray, map } from "./lib/utils";
44

55
class Interpreter {
66
constructor(serialization, experimentSalt='global_salt', inputs={}, environment) {
7-
this._serialization = serialization;
7+
this._serialization = deepCopy(serialization);
88
if (!environment) {
99
this._env = new Assignment(experimentSalt);
1010
} else {
@@ -35,7 +35,7 @@ class Interpreter {
3535
inputVal = defaultVal;
3636
}
3737
var envVal = this._env.get(name);
38-
if (envVal !== undefined && envVal !== null) {
38+
if (envVal !== undefined && envVal !== null) {
3939
return envVal;
4040
}
4141
return inputVal;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "planout",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"dependencies": {
55
"sha1": "1.1.0",
66
"bignumber.js": "2.0.7"

0 commit comments

Comments
 (0)