Skip to content
This repository was archived by the owner on Jan 26, 2021. It is now read-only.

Commit 3f4a311

Browse files
committed
Refactors changes to reflect pull request feedback
1 parent e667896 commit 3f4a311

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

src/Mutation.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,17 @@ function validateColumn(column: string) {
6565
}
6666

6767
function validateFields(data) {
68-
69-
function hasMutlipleGeoPoints() {
70-
var geoPointCount = 0;
71-
for (var prop in data) {
72-
if (data.hasOwnProperty(prop) &&
73-
(data[prop] instanceof Parse.GeoPoint)) {
74-
++geoPointCount;
75-
if (geoPointCount > 1) {
76-
return true;
77-
}
78-
}
68+
// Check for multiple GeoPoints.
69+
var geoPointCount = 0;
70+
for (var prop in data) {
71+
if (data.hasOwnProperty(prop) &&
72+
(data[prop] instanceof Parse.GeoPoint)) {
73+
++geoPointCount;
74+
if (geoPointCount > 1) {
75+
throw Error('There can only be 1 GeoPoint when mutating an object.');
76+
}
7977
}
80-
return false;
81-
};
78+
}
8279

8380
if (data.hasOwnProperty('objectId')) {
8481
warning('Ignoring reserved field: objectId');
@@ -96,9 +93,6 @@ function validateFields(data) {
9693
warning('Ignoring reserved field: updatedAt');
9794
delete data.updatedAt;
9895
}
99-
if (hasMutlipleGeoPoints()) {
100-
throw Error('There can only be 1 GeoPoint when mutating an object.');
101-
}
10296
}
10397

10498
class Mutation {

src/__tests__/Mutation-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('Mutation Generators', function() {
5555
g1: new Parse.GeoPoint(),
5656
g2: new Parse.GeoPoint(),
5757
});
58-
}).toThrow();
58+
}).toThrow('There can only be 1 GeoPoint when mutating an object.');
5959
});
6060

6161
it('generates an Unset Mutation', function() {

0 commit comments

Comments
 (0)