Skip to content

Commit 8394a41

Browse files
committed
more cleanup
1 parent 72bd971 commit 8394a41

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Breinify.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
var _privates = {
122122
ready: false,
123123

124-
storeSplitTest: function(data) {
124+
storeAdditionalData: function(data) {
125125
var additionalData;
126126
if (!$.isPlainObject(data)) {
127127
return;
@@ -139,17 +139,28 @@
139139
return;
140140
}
141141

142-
// iterate over the additionalData
142+
// iterate over the additionalData instances
143143
for (var k = 0; k < additionalData.length; k++) {
144-
// console.log(additionalData);
144+
this.storeSplitTest(additionalData[k]);
145145
}
146146
},
147147

148+
storeSplitTest: function(additionalData) {
149+
if (!$.isPlainObject(additionalData)) {
150+
return;
151+
} else if (!$.isPlainObject(additionalData.splitTestData)) {
152+
return;
153+
}
154+
155+
var splitTestData = additionalData.splitTestData;
156+
// console.log(splitTestData);
157+
},
158+
148159
handleRecommendationResponse: function(data, errorText, callback) {
149160

150161
// we check for split-tests and store the results in the localStorage
151162
try {
152-
this.storeSplitTest(data);
163+
this.storeAdditionalData(data);
153164
} catch (e) {
154165
// ignore the exception, we still want to handle the response
155166
}

0 commit comments

Comments
 (0)