diff --git a/.eslintrc.json b/.eslintrc.json index 8c7060f739..6aca52ccc4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,6 +20,7 @@ "eol-last": 2, "space-in-parens": ["error", "never"], "no-multiple-empty-lines": 1, - "prefer-const": "error" + "prefer-const": "error", + "space-infix-ops": "error" } } diff --git a/spec/AuthenticationAdapters.spec.js b/spec/AuthenticationAdapters.spec.js index 56833179bb..501b64b392 100644 --- a/spec/AuthenticationAdapters.spec.js +++ b/spec/AuthenticationAdapters.spec.js @@ -6,8 +6,8 @@ var path = require('path'); describe('AuthenticationProviers', function() { ["facebook", "github", "instagram", "google", "linkedin", "meetup", "twitter", "janrainengage", "janraincapture", "vkontakte"].map(function(providerName){ - it("Should validate structure of "+providerName, (done) => { - var provider = require("../src/Adapters/Auth/"+providerName); + it("Should validate structure of " + providerName, (done) => { + var provider = require("../src/Adapters/Auth/" + providerName); jequal(typeof provider.validateAuthData, "function"); jequal(typeof provider.validateAppId, "function"); jequal(provider.validateAuthData({}, {}).constructor, Promise.prototype.constructor); diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 236f10a80b..d83dd8b2de 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -1361,7 +1361,7 @@ describe('afterFind hooks', () => { Parse.Cloud.afterFind('MyObject', (req, res) => { const filteredResults = []; for(let i = 0 ; i < req.objects.length ; i++){ - if(req.objects[i].get("secretField")==="SSID1") { + if(req.objects[i].get("secretField") === "SSID1") { filteredResults.push(req.objects[i]); } } diff --git a/spec/HTTPRequest.spec.js b/spec/HTTPRequest.spec.js index 4bf88c517a..061b616f98 100644 --- a/spec/HTTPRequest.spec.js +++ b/spec/HTTPRequest.spec.js @@ -6,7 +6,7 @@ var httpRequest = require("../src/cloud-code/httpRequest"), express = require("express"); var port = 13371; -var httpRequestServer = "http://localhost:"+port; +var httpRequestServer = "http://localhost:" + port; var app = express(); app.use(bodyParser.json({ 'type': '*/*' })); @@ -39,7 +39,7 @@ app.listen(13371); describe("httpRequest", () => { it("should do /hello", (done) => { httpRequest({ - url: httpRequestServer+"/hello" + url: httpRequestServer + "/hello" }).then(function(httpResponse){ expect(httpResponse.status).toBe(200); expect(httpResponse.buffer).toEqual(new Buffer('{"response":"OK"}')); @@ -55,7 +55,7 @@ describe("httpRequest", () => { it("should do /hello with callback and promises", (done) => { var calls = 0; httpRequest({ - url: httpRequestServer+"/hello", + url: httpRequestServer + "/hello", success: function() { calls++; }, error: function() { calls++; } }).then(function(httpResponse){ @@ -74,7 +74,7 @@ describe("httpRequest", () => { it("should do not follow redirects by default", (done) => { httpRequest({ - url: httpRequestServer+"/301" + url: httpRequestServer + "/301" }).then(function(httpResponse){ expect(httpResponse.status).toBe(301); done(); @@ -87,7 +87,7 @@ describe("httpRequest", () => { it("should follow redirects when set", (done) => { httpRequest({ - url: httpRequestServer+"/301", + url: httpRequestServer + "/301", followRedirects: true }).then(function(httpResponse){ expect(httpResponse.status).toBe(200); @@ -104,7 +104,7 @@ describe("httpRequest", () => { it("should fail on 404", (done) => { var calls = 0; httpRequest({ - url: httpRequestServer+"/404", + url: httpRequestServer + "/404", success: function() { calls++; fail("should not succeed"); @@ -124,7 +124,7 @@ describe("httpRequest", () => { it("should fail on 404", (done) => { httpRequest({ - url: httpRequestServer+"/404", + url: httpRequestServer + "/404", }).then(function(){ fail("should not succeed"); done(); @@ -141,7 +141,7 @@ describe("httpRequest", () => { var calls = 0; httpRequest({ method: "POST", - url: httpRequestServer+"/echo", + url: httpRequestServer + "/echo", body: { foo: "bar" }, @@ -218,7 +218,7 @@ describe("httpRequest", () => { it("should params object to query string", (done) => { httpRequest({ - url: httpRequestServer+"/qs", + url: httpRequestServer + "/qs", params: { foo: "bar" } @@ -234,7 +234,7 @@ describe("httpRequest", () => { it("should params string to query string", (done) => { httpRequest({ - url: httpRequestServer+"/qs", + url: httpRequestServer + "/qs", params: "foo=bar&foo2=bar2" }).then(function(httpResponse){ expect(httpResponse.status).toBe(200); diff --git a/spec/Logger.spec.js b/spec/Logger.spec.js index 8a869ec245..d4e3124534 100644 --- a/spec/Logger.spec.js +++ b/spec/Logger.spec.js @@ -52,7 +52,7 @@ describe('Logger', () => { logging.logger.info('hi', {key: 'value'}); expect(process.stdout.write).toHaveBeenCalled(); var firstLog = process.stdout.write.calls.first().args[0]; - expect(firstLog).toEqual(JSON.stringify({key: 'value', level: 'info', message: 'hi' })+'\n'); + expect(firstLog).toEqual(JSON.stringify({key: 'value', level: 'info', message: 'hi' }) + '\n'); return reconfigureServer({ jsonLogs: false }); diff --git a/spec/OAuth1.spec.js b/spec/OAuth1.spec.js index a6dce9827e..15e55d3bc7 100644 --- a/spec/OAuth1.spec.js +++ b/spec/OAuth1.spec.js @@ -64,7 +64,7 @@ describe('OAuth', function() { var req = oauthClient.buildRequest(method, path, {"query": "param"}); jequal(req.host, options.host); - jequal(req.path, "/"+path+"?query=param"); + jequal(req.path, "/" + path + "?query=param"); jequal(req.method, "GET"); jequal(req.headers['Content-Type'], 'application/x-www-form-urlencoded'); jequal(req.headers['Authorization'], 'OAuth oauth_consumer_key="hello", oauth_nonce="AAAAAAAAAAAAAAAAA", oauth_signature="wNkyEkDE%2F0JZ2idmqyrgHdvC0rs%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="123450000", oauth_token="token", oauth_version="1.0"') diff --git a/spec/Parse.Push.spec.js b/spec/Parse.Push.spec.js index b9ead0b544..504a8b32c2 100644 --- a/spec/Parse.Push.spec.js +++ b/spec/Parse.Push.spec.js @@ -10,7 +10,7 @@ describe('Parse.Push', () => { const promises = installations.map((installation) => { if (installation.deviceType == "ios") { expect(installation.badge).toEqual(badge); - expect(installation.originalBadge+1).toEqual(installation.badge); + expect(installation.originalBadge + 1).toEqual(installation.badge); } else { expect(installation.badge).toBeUndefined(); } @@ -39,8 +39,8 @@ describe('Parse.Push', () => { var installations = []; while(installations.length != 10) { var installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("badge", installations.length); installation.set("originalBadge", installations.length); installation.set("deviceType", "ios"); diff --git a/spec/ParseAPI.spec.js b/spec/ParseAPI.spec.js index 01a92a30de..3c7121b1a5 100644 --- a/spec/ParseAPI.spec.js +++ b/spec/ParseAPI.spec.js @@ -825,7 +825,7 @@ describe('miscellaneous', function() { }; request.put({ headers: headers, - url: 'http://localhost:8378/1/classes/GameScore/'+obj.id, + url: 'http://localhost:8378/1/classes/GameScore/' + obj.id, body: JSON.stringify({ a: 'b', c: {"__op":"Increment","amount":2}, @@ -1241,7 +1241,7 @@ describe('miscellaneous', function() { amount: amount } }, - url: 'http://localhost:8378/1/classes/AnObject/'+object.id + url: 'http://localhost:8378/1/classes/AnObject/' + object.id }) return new Promise((resolve, reject) => { request.put(options, (err, res, body) => { diff --git a/spec/ParseHooks.spec.js b/spec/ParseHooks.spec.js index 0747981c5d..921cad6fe1 100644 --- a/spec/ParseHooks.spec.js +++ b/spec/ParseHooks.spec.js @@ -7,7 +7,7 @@ var express = require("express"); var bodyParser = require('body-parser'); var port = 12345; -var hookServerURL = "http://localhost:"+port; +var hookServerURL = "http://localhost:" + port; const AppCache = require('../src/cache').AppCache; var app = express(); @@ -129,7 +129,7 @@ describe('Hooks', () => { }); it("should fail to register hooks without Master Key", (done) => { - request.post(Parse.serverURL+"/hooks/functions", { + request.post(Parse.serverURL + "/hooks/functions", { headers: { "X-Parse-Application-Id": Parse.applicationId, "X-Parse-REST-API-Key": Parse.restKey, @@ -254,7 +254,7 @@ describe('Hooks', () => { }); it("should fail trying to create a malformed function (REST)", (done) => { - request.post(Parse.serverURL+"/hooks/functions", { + request.post(Parse.serverURL + "/hooks/functions", { headers: { "X-Parse-Application-Id": Parse.applicationId, "X-Parse-Master-Key": Parse.masterKey, @@ -272,18 +272,18 @@ describe('Hooks', () => { it("should create hooks and properly preload them", (done) => { var promises = []; - for (var i = 0; i<5; i++) { - promises.push(Parse.Hooks.createTrigger("MyClass"+i, "beforeSave", "http://url.com/beforeSave/"+i)); - promises.push(Parse.Hooks.createFunction("AFunction"+i, "http://url.com/function"+i)); + for (var i = 0; i < 5; i++) { + promises.push(Parse.Hooks.createTrigger("MyClass" + i, "beforeSave", "http://url.com/beforeSave/" + i)); + promises.push(Parse.Hooks.createFunction("AFunction" + i, "http://url.com/function" + i)); } Parse.Promise.when(promises).then(function(){ - for (var i=0; i<5; i++) { + for (var i = 0; i < 5; i++) { // Delete everything from memory, as the server just started - triggers.removeTrigger("beforeSave", "MyClass"+i, Parse.applicationId); - triggers.removeFunction("AFunction"+i, Parse.applicationId); - expect(triggers.getTrigger("MyClass"+i, "beforeSave", Parse.applicationId)).toBeUndefined(); - expect(triggers.getFunction("AFunction"+i, Parse.applicationId)).toBeUndefined(); + triggers.removeTrigger("beforeSave", "MyClass" + i, Parse.applicationId); + triggers.removeFunction("AFunction" + i, Parse.applicationId); + expect(triggers.getTrigger("MyClass" + i, "beforeSave", Parse.applicationId)).toBeUndefined(); + expect(triggers.getFunction("AFunction" + i, Parse.applicationId)).toBeUndefined(); } const hooksController = new HooksController(Parse.applicationId, AppCache.get('test').databaseController); return hooksController.load() @@ -292,9 +292,9 @@ describe('Hooks', () => { fail('Should properly create all hooks'); done(); }).then(function() { - for (var i=0; i<5; i++) { - expect(triggers.getTrigger("MyClass"+i, "beforeSave", Parse.applicationId)).not.toBeUndefined(); - expect(triggers.getFunction("AFunction"+i, Parse.applicationId)).not.toBeUndefined(); + for (var i = 0; i < 5; i++) { + expect(triggers.getTrigger("MyClass" + i, "beforeSave", Parse.applicationId)).not.toBeUndefined(); + expect(triggers.getFunction("AFunction" + i, Parse.applicationId)).not.toBeUndefined(); } done(); }, (err) => { @@ -310,7 +310,7 @@ describe('Hooks', () => { res.json({success:"OK!"}); }); - Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/SomeFunction").then(function(){ + Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/SomeFunction").then(function(){ return Parse.Cloud.run("SOME_TEST_FUNCTION") }, (err) => { jfail(err); @@ -332,7 +332,7 @@ describe('Hooks', () => { res.json({error: {code: 1337, error: "hacking that one!"}}); }); // The function is deleted as the DB is dropped between calls - Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/SomeFunctionError").then(function(){ + Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/SomeFunctionError").then(function(){ return Parse.Cloud.run("SOME_TEST_FUNCTION") }, (err) => { jfail(err); @@ -362,7 +362,7 @@ describe('Hooks', () => { } }); - Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/ExpectingKey").then(function(){ + Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/ExpectingKey").then(function(){ return Parse.Cloud.run("SOME_TEST_FUNCTION") }, (err) => { jfail(err); @@ -389,7 +389,7 @@ describe('Hooks', () => { } }); - Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/ExpectingKeyAlso").then(function(){ + Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/ExpectingKeyAlso").then(function(){ return Parse.Cloud.run("SOME_TEST_FUNCTION") }, (err) => { jfail(err); @@ -422,7 +422,7 @@ describe('Hooks', () => { res.json({success: object}); }); // The function is delete as the DB is dropped between calls - Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL+"/BeforeSaveSome").then(function(){ + Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL + "/BeforeSaveSome").then(function(){ const obj = new Parse.Object("SomeRandomObject"); return obj.save(); }).then(function(res) { @@ -444,7 +444,7 @@ describe('Hooks', () => { object.set('hello', "world"); res.json({success: object}); }); - Parse.Hooks.createTrigger("SomeRandomObject2", "beforeSave" ,hookServerURL+"/BeforeSaveSome2").then(function(){ + Parse.Hooks.createTrigger("SomeRandomObject2", "beforeSave" ,hookServerURL + "/BeforeSaveSome2").then(function(){ const obj = new Parse.Object("SomeRandomObject2"); return obj.save(); }).then(function(res) { @@ -471,7 +471,7 @@ describe('Hooks', () => { }) }); // The function is delete as the DB is dropped between calls - Parse.Hooks.createTrigger("SomeRandomObject", "afterSave" ,hookServerURL+"/AfterSaveSome").then(function(){ + Parse.Hooks.createTrigger("SomeRandomObject", "afterSave" ,hookServerURL + "/AfterSaveSome").then(function(){ const obj = new Parse.Object("SomeRandomObject"); return obj.save(); }).then(function() { diff --git a/spec/ParseObject.spec.js b/spec/ParseObject.spec.js index b959d3b8b3..4afc48c4cc 100644 --- a/spec/ParseObject.spec.js +++ b/spec/ParseObject.spec.js @@ -1390,7 +1390,7 @@ describe('Parse.Object testing', () => { } equal(itemsAgain.length, numItems, "Should get the array back"); itemsAgain.forEach(function(item, i) { - var newValue = i*2; + var newValue = i * 2; item.set("x", newValue); }); return Parse.Object.saveAll(itemsAgain); @@ -1400,7 +1400,7 @@ describe('Parse.Object testing', () => { equal(fetchedItemsAgain.length, numItems, "Number of items fetched should not change"); fetchedItemsAgain.forEach(function(item, i) { - equal(item.get("x"), i*2); + equal(item.get("x"), i * 2); }); done(); }); @@ -1457,7 +1457,7 @@ describe('Parse.Object testing', () => { } equal(itemsAgain.length, numItems, "Should get the array back"); itemsAgain.forEach(function(item, i) { - var newValue = i*2; + var newValue = i * 2; item.set("x", newValue); }); return Parse.Object.saveAll(itemsAgain); @@ -1467,7 +1467,7 @@ describe('Parse.Object testing', () => { equal(fetchedItemsAgain.length, numItems, "Number of items fetched should not change"); fetchedItemsAgain.forEach(function(item, i) { - equal(item.get("x"), i*2); + equal(item.get("x"), i * 2); }); done(); }, @@ -1581,7 +1581,7 @@ describe('Parse.Object testing', () => { return; } itemsAgain.forEach(function(item, i) { - item.set("x", i*2); + item.set("x", i * 2); }); return Parse.Object.saveAll(itemsAgain); }).then(function() { @@ -1619,7 +1619,7 @@ describe('Parse.Object testing', () => { return; } itemsAgain.forEach(function(item, i) { - item.set("x", i*2); + item.set("x", i * 2); }); return Parse.Object.saveAll(itemsAgain); }).then(function() { diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 45e522e761..69e6cd2320 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -1652,8 +1652,8 @@ describe('Parse.Query testing', () => { } Parse.Object.saveAll(objects).then(() => { const object = new Parse.Object("AContainer"); - for (var i=0; i { it('query match on array with multiple objects', (done) => { var target1 = {__type: 'Pointer', className: 'TestObject', objectId: 'abc'}; var target2 = {__type: 'Pointer', className: 'TestObject', objectId: '123'}; - var obj= new Parse.Object('TestObject'); + var obj = new Parse.Object('TestObject'); obj.set('someObjs', [target1, target2]); obj.save().then(() => { var query = new Parse.Query('TestObject'); diff --git a/spec/ParseRole.spec.js b/spec/ParseRole.spec.js index 24a14bd6e0..a1877a1269 100644 --- a/spec/ParseRole.spec.js +++ b/spec/ParseRole.spec.js @@ -124,7 +124,7 @@ describe('Parse Role testing', () => { expect(roles.length).toEqual(4); allRoles.forEach(function(name) { - expect(roles.indexOf("role:"+name)).not.toBe(-1); + expect(roles.indexOf("role:" + name)).not.toBe(-1); }); // 1 Query for the initial setup @@ -165,7 +165,7 @@ describe('Parse Role testing', () => { }).then((roles) => { expect(roles.length).toEqual(3); rolesNames.forEach((name) => { - expect(roles.indexOf('role:'+name)).not.toBe(-1); + expect(roles.indexOf('role:' + name)).not.toBe(-1); }); done(); }, function(){ diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index b0fcc4e02f..02d90a71dd 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -1678,7 +1678,7 @@ describe('Parse.User testing', () => { const userId = model.id; Parse.User.logOut().then(() => { request.post({ - url:Parse.serverURL+'/classes/_User', + url:Parse.serverURL + '/classes/_User', headers: { 'X-Parse-Application-Id': Parse.applicationId, 'X-Parse-REST-API-Key': 'rest' @@ -1688,7 +1688,7 @@ describe('Parse.User testing', () => { // make sure the location header is properly set expect(userId).not.toBeUndefined(); expect(body.objectId).toEqual(userId); - expect(res.headers.location).toEqual(Parse.serverURL+'/users/'+userId); + expect(res.headers.location).toEqual(Parse.serverURL + '/users/' + userId); done(); }); }); diff --git a/spec/PushController.spec.js b/spec/PushController.spec.js index bfe6517354..dd7b01316e 100644 --- a/spec/PushController.spec.js +++ b/spec/PushController.spec.js @@ -139,8 +139,8 @@ describe('PushController', () => { var installations = []; while(installations.length != 10) { const installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("badge", installations.length); installation.set("originalBadge", installations.length); installation.set("deviceType", "ios"); @@ -149,8 +149,8 @@ describe('PushController', () => { while(installations.length != 15) { const installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("deviceType", "android"); installations.push(installation); } @@ -161,7 +161,7 @@ describe('PushController', () => { installations.forEach((installation) => { if (installation.deviceType == "ios") { expect(installation.badge).toEqual(badge); - expect(installation.originalBadge+1).toEqual(installation.badge); + expect(installation.originalBadge + 1).toEqual(installation.badge); } else { expect(installation.badge).toBeUndefined(); } @@ -199,8 +199,8 @@ describe('PushController', () => { var installations = []; while(installations.length != 10) { var installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("badge", installations.length); installation.set("originalBadge", installations.length); installation.set("deviceType", "ios"); @@ -249,8 +249,8 @@ describe('PushController', () => { var installations = []; while(installations.length != 10) { var installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("badge", installations.length); installation.set("originalBadge", installations.length); installation.set("deviceType", "ios"); @@ -305,8 +305,8 @@ describe('PushController', () => { var installations = []; while(installations.length != 10) { const installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("badge", installations.length); installation.set("originalBadge", installations.length); installation.set("deviceType", "ios"); @@ -315,8 +315,8 @@ describe('PushController', () => { while(installations.length != 15) { const installation = new Parse.Object("_Installation"); - installation.set("installationId", "installation_"+installations.length); - installation.set("deviceToken","device_token_"+installations.length) + installation.set("installationId", "installation_" + installations.length); + installation.set("deviceToken","device_token_" + installations.length) installation.set("deviceType", "android"); installations.push(installation); } diff --git a/spec/PushRouter.spec.js b/spec/PushRouter.spec.js index 9be3137a7a..411076a270 100644 --- a/spec/PushRouter.spec.js +++ b/spec/PushRouter.spec.js @@ -70,7 +70,7 @@ describe('PushRouter', () => { it('sends a push through REST', (done) => { request.post({ - url: Parse.serverURL+"/push", + url: Parse.serverURL + "/push", json: true, body: { 'channels': { diff --git a/spec/RevocableSessionsUpgrade.spec.js b/spec/RevocableSessionsUpgrade.spec.js index 0fccf51565..8eeac8eacf 100644 --- a/spec/RevocableSessionsUpgrade.spec.js +++ b/spec/RevocableSessionsUpgrade.spec.js @@ -71,7 +71,7 @@ describe_only_db('mongo')('revocable sessions', () => { it('should not upgrade bad legacy session token', done => { rp.post({ - url: Parse.serverURL+'/upgradeToRevocableSession', + url: Parse.serverURL + '/upgradeToRevocableSession', headers: { 'X-Parse-Application-Id': Parse.applicationId, 'X-Parse-Rest-API-Key': 'rest', @@ -92,7 +92,7 @@ describe_only_db('mongo')('revocable sessions', () => { it('should not crash without session token #2720', done => { rp.post({ - url: Parse.serverURL+'/upgradeToRevocableSession', + url: Parse.serverURL + '/upgradeToRevocableSession', headers: { 'X-Parse-Application-Id': Parse.applicationId, 'X-Parse-Rest-API-Key': 'rest' diff --git a/spec/helper.js b/spec/helper.js index 432960ea9d..854bbd1879 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -167,7 +167,7 @@ Parse.serverURL = 'http://localhost:' + port + '/1'; Parse.Promise.disableAPlusCompliant(); // 10 minutes timeout -beforeAll(startDB, 10*60*1000); +beforeAll(startDB, 10 * 60 * 1000); afterAll(stopDB); diff --git a/spec/rest.spec.js b/spec/rest.spec.js index 7b481fae81..f83dbd0252 100644 --- a/spec/rest.spec.js +++ b/spec/rest.spec.js @@ -374,7 +374,7 @@ describe('rest create', () => { var session = r.results[0]; var actual = new Date(session.expiresAt.iso); - var expected = new Date(now.getTime() + (sessionLength*1000)); + var expected = new Date(now.getTime() + (sessionLength * 1000)); expect(actual.getFullYear()).toEqual(expected.getFullYear()); expect(actual.getMonth()).toEqual(expected.getMonth()); diff --git a/spec/schemas.spec.js b/spec/schemas.spec.js index 3e9561e455..3dfadcfc92 100644 --- a/spec/schemas.spec.js +++ b/spec/schemas.spec.js @@ -1230,7 +1230,7 @@ describe('schemas', () => { } return new Promise((resolve, reject) => { op({ - url: 'http://localhost:8378/1/schemas/'+className, + url: 'http://localhost:8378/1/schemas/' + className, headers: masterKeyHeaders, json: true, body: { diff --git a/src/AccountLockout.js b/src/AccountLockout.js index 17430e4b9c..d75a177a90 100644 --- a/src/AccountLockout.js +++ b/src/AccountLockout.js @@ -98,7 +98,7 @@ export class AccountLockout { const now = new Date(); const updateFields = { - _account_lockout_expires_at: Parse._encode(new Date(now.getTime() + this._config.accountLockout.duration*60*1000)) + _account_lockout_expires_at: Parse._encode(new Date(now.getTime() + this._config.accountLockout.duration * 60 * 1000)) }; this._config.database.update('_User', query, updateFields) diff --git a/src/Adapters/Auth/OAuth1Client.js b/src/Adapters/Auth/OAuth1Client.js index 00bb322d32..2fb2057308 100644 --- a/src/Adapters/Auth/OAuth1Client.js +++ b/src/Adapters/Auth/OAuth1Client.js @@ -36,7 +36,7 @@ OAuth.prototype.send = function(method, path, params, body){ OAuth.prototype.buildRequest = function(method, path, params, body) { if (path.indexOf("/") != 0) { - path = "/"+path; + path = "/" + path; } if (params && Object.keys(params).length > 0) { path += "?" + OAuth.buildParameterString(params); @@ -118,7 +118,7 @@ OAuth.nonce = function(){ var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for(var i=0; i < 30; i++) + for(var i = 0; i < 30; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; @@ -162,7 +162,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to oauth_parameters.oauth_nonce = OAuth.nonce(); } if (!oauth_parameters.oauth_timestamp) { - oauth_parameters.oauth_timestamp = Math.floor(new Date().getTime()/1000); + oauth_parameters.oauth_timestamp = Math.floor(new Date().getTime() / 1000); } if (!oauth_parameters.oauth_signature_method) { oauth_parameters.oauth_signature_method = OAuth.signatureMethod; @@ -172,7 +172,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to } if(!auth_token_secret){ - auth_token_secret=""; + auth_token_secret = ""; } // Force GET method if unset if (!request.method) { @@ -193,7 +193,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to var parameterString = OAuth.buildParameterString(signatureParams); // Build the signature string - var url = "https://"+request.host+""+request.path; + var url = "https://" + request.host + "" + request.path; var signatureString = OAuth.buildSignatureString(request.method, url, parameterString); // Hash the signature string @@ -210,7 +210,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to // Set the authorization header var authHeader = Object.keys(oauth_parameters).sort().map(function(key){ var value = oauth_parameters[key]; - return key+'="'+value+'"'; + return key + '="' + value + '"'; }).join(", ") request.headers.Authorization = 'OAuth ' + authHeader; diff --git a/src/Adapters/Auth/github.js b/src/Adapters/Auth/github.js index 7f4713546a..e6e2c05e8c 100644 --- a/src/Adapters/Auth/github.js +++ b/src/Adapters/Auth/github.js @@ -27,7 +27,7 @@ function request(path, access_token) { host: 'api.github.com', path: '/' + path, headers: { - 'Authorization': 'bearer '+access_token, + 'Authorization': 'bearer ' + access_token, 'User-Agent': 'parse-server' } }, function(res) { diff --git a/src/Adapters/Auth/google.js b/src/Adapters/Auth/google.js index 2cf519d4d0..4699c83789 100644 --- a/src/Adapters/Auth/google.js +++ b/src/Adapters/Auth/google.js @@ -3,7 +3,7 @@ var https = require('https'); var Parse = require('parse/node').Parse; function validateIdToken(id, token) { - return request("tokeninfo?id_token="+token) + return request("tokeninfo?id_token=" + token) .then((response) => { if (response && (response.sub == id || response.user_id == id)) { return; @@ -15,7 +15,7 @@ function validateIdToken(id, token) { } function validateAuthToken(id, token) { - return request("tokeninfo?access_token="+token) + return request("tokeninfo?access_token=" + token) .then((response) => { if (response && (response.sub == id || response.user_id == id)) { return; diff --git a/src/Adapters/Auth/instagram.js b/src/Adapters/Auth/instagram.js index 97382fb240..1c6c0f73cf 100644 --- a/src/Adapters/Auth/instagram.js +++ b/src/Adapters/Auth/instagram.js @@ -4,7 +4,7 @@ var Parse = require('parse/node').Parse; // Returns a promise that fulfills iff this user id is valid. function validateAuthData(authData) { - return request("users/self/?access_token="+authData.access_token) + return request("users/self/?access_token=" + authData.access_token) .then((response) => { if (response && response.data && response.data.id == authData.id) { return; diff --git a/src/Adapters/Auth/meetup.js b/src/Adapters/Auth/meetup.js index d137b7aad4..e5c7e2c91e 100644 --- a/src/Adapters/Auth/meetup.js +++ b/src/Adapters/Auth/meetup.js @@ -27,7 +27,7 @@ function request(path, access_token) { host: 'api.meetup.com', path: '/2/' + path, headers: { - 'Authorization': 'bearer '+access_token + 'Authorization': 'bearer ' + access_token } }, function(res) { var data = ''; diff --git a/src/Adapters/Auth/qq.js b/src/Adapters/Auth/qq.js index ad77749516..376a5e650b 100644 --- a/src/Adapters/Auth/qq.js +++ b/src/Adapters/Auth/qq.js @@ -26,12 +26,12 @@ function graphRequest(path) { data += chunk; }); res.on('end', function () { - var starPos=data.indexOf("("); - var endPos=data.indexOf(")"); - if(starPos==-1||endPos==-1){ + var starPos = data.indexOf("("); + var endPos = data.indexOf(")"); + if(starPos == -1 || endPos == -1){ throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq auth is invalid for this user.'); } - data=data.substring(starPos+1,endPos-1); + data = data.substring(starPos + 1,endPos - 1); data = JSON.parse(data); resolve(data); }); diff --git a/src/Adapters/Auth/spotify.js b/src/Adapters/Auth/spotify.js index 56ebb1ae42..7c39ed65e9 100644 --- a/src/Adapters/Auth/spotify.js +++ b/src/Adapters/Auth/spotify.js @@ -41,7 +41,7 @@ function request(path, access_token) { host: 'api.spotify.com', path: '/v1/' + path, headers: { - 'Authorization': 'Bearer '+access_token + 'Authorization': 'Bearer ' + access_token } }, function(res) { var data = ''; diff --git a/src/Adapters/Auth/twitter.js b/src/Adapters/Auth/twitter.js index 87a0a738f8..81f7f135c6 100644 --- a/src/Adapters/Auth/twitter.js +++ b/src/Adapters/Auth/twitter.js @@ -12,7 +12,7 @@ function validateAuthData(authData, options) { client.auth_token_secret = authData.auth_token_secret; return client.get("/1.1/account/verify_credentials.json").then((data) => { - if (data && data.id_str == ''+authData.id) { + if (data && data.id_str == '' + authData.id) { return; } throw new Parse.Error( diff --git a/src/Adapters/Auth/wechat.js b/src/Adapters/Auth/wechat.js index b3a32f1190..77cd7cfa2a 100644 --- a/src/Adapters/Auth/wechat.js +++ b/src/Adapters/Auth/wechat.js @@ -4,7 +4,7 @@ var Parse = require('parse/node').Parse; // Returns a promise that fulfills iff this user id is valid. function validateAuthData(authData) { - return graphRequest('auth?access_token=' + authData.access_token +'&openid=' +authData.id).then(function (data) { + return graphRequest('auth?access_token=' + authData.access_token + '&openid=' + authData.id).then(function (data) { if (data.errcode == 0) { return; } diff --git a/src/Adapters/Storage/Mongo/MongoTransform.js b/src/Adapters/Storage/Mongo/MongoTransform.js index 1c6e7d2b16..e91abbb563 100644 --- a/src/Adapters/Storage/Mongo/MongoTransform.js +++ b/src/Adapters/Storage/Mongo/MongoTransform.js @@ -109,7 +109,7 @@ const transformKeyValueForUpdate = (className, restKey, restValue, parseFormatSc } const transformInteriorValue = restValue => { - if (restValue !== null && typeof restValue === 'object' && Object.keys(restValue).some(key => key.includes('$')|| key.includes('.'))) { + if (restValue !== null && typeof restValue === 'object' && Object.keys(restValue).some(key => key.includes('$') || key.includes('.'))) { throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters"); } // Handle atomic values diff --git a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js index 40a2ee1bc2..76473c0c33 100644 --- a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js +++ b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js @@ -11,7 +11,7 @@ const logger = require('../../../logger'); const debug = function(){ let args = [...arguments]; - args = ['PG: '+arguments[0]].concat(args.slice(1, args.length)); + args = ['PG: ' + arguments[0]].concat(args.slice(1, args.length)); const log = logger.getLogger(); log.debug.apply(log, args); } @@ -196,8 +196,8 @@ const buildWhereClause = ({ schema, query, index }) => { } return `'${cmpt}'`; }); - let name = components.slice(0, components.length-1).join('->'); - name+='->>'+components[components.length-1]; + let name = components.slice(0, components.length - 1).join('->'); + name += '->>' + components[components.length - 1]; patterns.push(`${name} = '${fieldValue}'`); } else if (typeof fieldValue === 'string') { patterns.push(`$${index}:name = $${index + 1}`); @@ -277,7 +277,7 @@ const buildWhereClause = ({ schema, query, index }) => { if (baseArray.length > 0) { const not = notIn ? ' NOT ' : ''; if (isArrayField) { - patterns.push(`${not} array_contains($${index}:name, $${index+1})`); + patterns.push(`${not} array_contains($${index}:name, $${index + 1})`); values.push(fieldName, JSON.stringify(baseArray)); index += 2; } else { @@ -305,9 +305,9 @@ const buildWhereClause = ({ schema, query, index }) => { } if (Array.isArray(fieldValue.$all) && isArrayField) { - patterns.push(`array_contains_all($${index}:name, $${index+1}::jsonb)`); + patterns.push(`array_contains_all($${index}:name, $${index + 1}::jsonb)`); values.push(fieldName, JSON.stringify(fieldValue.$all)); - index+=2; + index += 2; } if (typeof fieldValue.$exists !== 'undefined') { @@ -323,9 +323,9 @@ const buildWhereClause = ({ schema, query, index }) => { if (fieldValue.$nearSphere) { const point = fieldValue.$nearSphere; const distance = fieldValue.$maxDistance; - const distanceInKM = distance*6371*1000; - patterns.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index+1}, $${index+2})::geometry) <= $${index+3}`); - sorts.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index+1}, $${index+2})::geometry) ASC`) + const distanceInKM = distance * 6371 * 1000; + patterns.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) <= $${index + 3}`); + sorts.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) ASC`) values.push(fieldName, point.longitude, point.latitude, distanceInKM); index += 4; } @@ -337,7 +337,7 @@ const buildWhereClause = ({ schema, query, index }) => { const right = box[1].longitude; const top = box[1].latitude; - patterns.push(`$${index}:name::point <@ $${index+1}::box`); + patterns.push(`$${index}:name::point <@ $${index + 1}::box`); values.push(fieldName, `((${left}, ${bottom}), (${right}, ${top}))`); index += 2; } @@ -357,7 +357,7 @@ const buildWhereClause = ({ schema, query, index }) => { regex = processRegexPattern(regex); - patterns.push(`$${index}:name ${operator} '$${index+1}:raw'`); + patterns.push(`$${index}:name ${operator} '$${index + 1}:raw'`); values.push(fieldName, regex); index += 2; } @@ -490,11 +490,11 @@ export class PostgresStorageAdapter { } valuesArray.push(fieldName); valuesArray.push(parseTypeToPostgresType(parseType)); - patternsArray.push(`$${index}:name $${index+1}:raw`); + patternsArray.push(`$${index}:name $${index + 1}:raw`); if (fieldName === 'objectId') { patternsArray.push(`PRIMARY KEY ($${index}:name)`) } - index = index+2; + index = index + 2; }); const qs = `CREATE TABLE IF NOT EXISTS $1:name (${patternsArray.join(',')})`; const values = [className, ...valuesArray]; @@ -618,7 +618,7 @@ export class PostgresStorageAdapter { const values = [className, ...fieldNames]; const columns = fieldNames.map((name, idx) => { - return `$${idx+2}:name`; + return `$${idx + 2}:name`; }).join(','); const doBatch = (t) => { @@ -699,8 +699,8 @@ export class PostgresStorageAdapter { } } - if (fieldName === '_account_lockout_expires_at'|| - fieldName === '_perishable_token_expires_at'|| + if (fieldName === '_account_lockout_expires_at' || + fieldName === '_perishable_token_expires_at' || fieldName === '_password_changed_at') { if (object[fieldName]) { valuesArray.push(object[fieldName].iso); @@ -762,7 +762,7 @@ export class PostgresStorageAdapter { const value = geoPoints[key]; valuesArray.push(value.longitude, value.latitude); const l = valuesArray.length + columnsArray.length; - return `POINT($${l}, $${l+1})`; + return `POINT($${l}, $${l + 1})`; }); const columnsPattern = columnsArray.map((col, index) => `$${index + 2}:name`).join(','); @@ -848,11 +848,11 @@ export class PostgresStorageAdapter { } const lastKey = `$${index}:name`; const fieldNameIndex = index; - index+=1; + index += 1; values.push(fieldName); const update = Object.keys(fieldValue).reduce((lastKey, key) => { - const str = generate(lastKey, `$${index}::text`, `$${index+1}::jsonb`) - index+=2; + const str = generate(lastKey, `$${index}::text`, `$${index + 1}::jsonb`) + index += 2; let value = fieldValue[key]; if (value) { if (value.__op === 'Delete') { @@ -997,7 +997,7 @@ export class PostgresStorageAdapter { if (hasLimit) { values.push(limit); } - const skipPattern = hasSkip ? `OFFSET $${values.length+1}` : ''; + const skipPattern = hasSkip ? `OFFSET $${values.length + 1}` : ''; if (hasSkip) { values.push(skip); } @@ -1024,7 +1024,7 @@ export class PostgresStorageAdapter { return key.length > 0; }); columns = keys.map((key, index) => { - return `$${index+values.length+1}:name`; + return `$${index + values.length + 1}:name`; }).join(','); values = values.concat(keys); } diff --git a/src/Config.js b/src/Config.js index d262aad4ad..c0af7ab07a 100644 --- a/src/Config.js +++ b/src/Config.js @@ -11,7 +11,7 @@ function removeTrailingSlash(str) { return str; } if (str.endsWith("/")) { - str = str.substr(0, str.length-1); + str = str.substr(0, str.length - 1); } return str; } @@ -207,7 +207,7 @@ export class Config { return undefined; } var now = new Date(); - return new Date(now.getTime() + (this.emailVerifyTokenValidityDuration*1000)); + return new Date(now.getTime() + (this.emailVerifyTokenValidityDuration * 1000)); } generatePasswordResetTokenExpiresAt() { @@ -223,7 +223,7 @@ export class Config { return undefined; } var now = new Date(); - return new Date(now.getTime() + (this.sessionLength*1000)); + return new Date(now.getTime() + (this.sessionLength * 1000)); } get invalidLinkURL() { diff --git a/src/Controllers/AdaptableController.js b/src/Controllers/AdaptableController.js index ca943c3ac7..f747a5a339 100644 --- a/src/Controllers/AdaptableController.js +++ b/src/Controllers/AdaptableController.js @@ -39,7 +39,7 @@ export class AdaptableController { validateAdapter(adapter) { if (!adapter) { - throw new Error(this.constructor.name+" requires an adapter"); + throw new Error(this.constructor.name + " requires an adapter"); } const Type = this.expectedAdapterType(); diff --git a/src/Controllers/LoggerController.js b/src/Controllers/LoggerController.js index dc7fb2d259..9da5dcf396 100644 --- a/src/Controllers/LoggerController.js +++ b/src/Controllers/LoggerController.js @@ -134,7 +134,7 @@ export class LoggerController extends AdaptableController { // until (optional) End time for the search. Defaults to current time. // order (optional) Direction of results returned, either “asc” or “desc”. Defaults to “desc”. // size (optional) Number of rows returned by search. Defaults to 10 - getLogs(options= {}) { + getLogs(options = {}) { if (!this.adapter) { throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED, 'Logger adapter is not available'); diff --git a/src/Controllers/PushController.js b/src/Controllers/PushController.js index d9c8775d27..e9f0790781 100644 --- a/src/Controllers/PushController.js +++ b/src/Controllers/PushController.js @@ -110,8 +110,8 @@ export class PushController extends AdaptableController { if (installation.deviceType != "ios") { badge = UNSUPPORTED_BADGE_KEY; } - map[badge+''] = map[badge+''] || []; - map[badge+''].push(installation); + map[badge + ''] = map[badge + ''] || []; + map[badge + ''].push(installation); return map; }, {}); diff --git a/src/Controllers/SchemaCache.js b/src/Controllers/SchemaCache.js index 2e75d8c4f2..8284d16f7e 100644 --- a/src/Controllers/SchemaCache.js +++ b/src/Controllers/SchemaCache.js @@ -21,10 +21,10 @@ export default class SchemaCache { } put(key, value) { - return this.cache.get(this.prefix+ALL_KEYS).then((allKeys) => { + return this.cache.get(this.prefix + ALL_KEYS).then((allKeys) => { allKeys = allKeys || {}; allKeys[key] = true; - return Promise.all([this.cache.put(this.prefix+ALL_KEYS, allKeys, this.ttl), this.cache.put(key, value, this.ttl)]); + return Promise.all([this.cache.put(this.prefix + ALL_KEYS, allKeys, this.ttl), this.cache.put(key, value, this.ttl)]); }); } @@ -32,32 +32,32 @@ export default class SchemaCache { if (!this.ttl) { return Promise.resolve(null); } - return this.cache.get(this.prefix+MAIN_SCHEMA); + return this.cache.get(this.prefix + MAIN_SCHEMA); } setAllClasses(schema) { if (!this.ttl) { return Promise.resolve(null); } - return this.put(this.prefix+MAIN_SCHEMA, schema); + return this.put(this.prefix + MAIN_SCHEMA, schema); } setOneSchema(className, schema) { if (!this.ttl) { return Promise.resolve(null); } - return this.put(this.prefix+className, schema); + return this.put(this.prefix + className, schema); } getOneSchema(className) { if (!this.ttl) { return Promise.resolve(null); } - return this.cache.get(this.prefix+className).then((schema) => { + return this.cache.get(this.prefix + className).then((schema) => { if (schema) { return Promise.resolve(schema); } - return this.cache.get(this.prefix+MAIN_SCHEMA).then((cachedSchemas) => { + return this.cache.get(this.prefix + MAIN_SCHEMA).then((cachedSchemas) => { cachedSchemas = cachedSchemas || []; schema = cachedSchemas.find((cachedSchema) => { return cachedSchema.className === className; @@ -72,7 +72,7 @@ export default class SchemaCache { clear() { // That clears all caches... - return this.cache.get(this.prefix+ALL_KEYS).then((allKeys) => { + return this.cache.get(this.prefix + ALL_KEYS).then((allKeys) => { if (!allKeys) { return; } diff --git a/src/Controllers/SchemaController.js b/src/Controllers/SchemaController.js index 9eee5ca458..f478f8727c 100644 --- a/src/Controllers/SchemaController.js +++ b/src/Controllers/SchemaController.js @@ -742,7 +742,7 @@ export default class SchemaController { if (missingColumns.length > 0) { throw new Parse.Error( Parse.Error.INCORRECT_TYPE, - missingColumns[0]+' is required.'); + missingColumns[0] + ' is required.'); } return Promise.resolve(this); } @@ -947,7 +947,7 @@ function getObjectType(obj) { } break; } - throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type); + throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid " + obj.__type); } if (obj['$ne']) { return getObjectType(obj['$ne']); diff --git a/src/LiveQuery/SessionTokenCache.js b/src/LiveQuery/SessionTokenCache.js index d496e1e0b9..bb7f5ab6ad 100644 --- a/src/LiveQuery/SessionTokenCache.js +++ b/src/LiveQuery/SessionTokenCache.js @@ -5,7 +5,7 @@ import logger from '../logger'; class SessionTokenCache { cache: Object; - constructor(timeout: number = 30 * 24 * 60 *60 * 1000, maxSize: number = 10000) { + constructor(timeout: number = 30 * 24 * 60 * 60 * 1000, maxSize: number = 10000) { this.cache = new LRU({ max: maxSize, maxAge: timeout diff --git a/src/PromiseRouter.js b/src/PromiseRouter.js index 0195941e6e..4d9a8873af 100644 --- a/src/PromiseRouter.js +++ b/src/PromiseRouter.js @@ -174,7 +174,7 @@ function makeExpressHandler(appId, promiseHandler) { // Override the default expressjs response // as it double encodes %encoded chars in URL if (!result.response) { - res.send('Found. Redirecting to '+result.location); + res.send('Found. Redirecting to ' + result.location); return; } } diff --git a/src/RestQuery.js b/src/RestQuery.js index e6c414ce69..592dcd25a8 100644 --- a/src/RestQuery.js +++ b/src/RestQuery.js @@ -110,7 +110,7 @@ function RestQuery(config, auth, className, restWhere = {}, restOptions = {}, cl // reduce to create all paths // ([a,b,c] -> {a: true, 'a.b': true, 'a.b.c': true}) return path.split('.').reduce((memo, path, index, parts) => { - memo[parts.slice(0, index+1).join('.')] = true; + memo[parts.slice(0, index + 1).join('.')] = true; return memo; }, memo); }, {}); @@ -552,8 +552,8 @@ function includePath(config, auth, response, path, restOptions = {}) { const keys = new Set(restOptions.keys.split(',')); const keySet = Array.from(keys).reduce((set, key) => { const keyPath = key.split('.'); - let i=0; - for (i; i { - console.log('['+process.pid+'] parse-server running on '+options.serverURL); + console.log('[' + process.pid + '] parse-server running on ' + options.serverURL); }); } } else { startServer(options, () => { logOptions(); console.log(''); - console.log('['+process.pid+'] parse-server running on '+options.serverURL); + console.log('[' + process.pid + '] parse-server running on ' + options.serverURL); }); } } diff --git a/src/cryptoUtils.js b/src/cryptoUtils.js index f29260bb63..9e67a04a3f 100644 --- a/src/cryptoUtils.js +++ b/src/cryptoUtils.js @@ -10,7 +10,7 @@ export function randomHexString(size: number): string { if (size % 2 !== 0) { throw new Error('randomHexString size must be divisible by 2.') } - return randomBytes(size/2).toString('hex'); + return randomBytes(size / 2).toString('hex'); } // Returns a new random alphanumeric string of the given size. diff --git a/src/triggers.js b/src/triggers.js index 8acd51ac6e..9f8a797b23 100644 --- a/src/triggers.js +++ b/src/triggers.js @@ -266,7 +266,7 @@ export function maybeRunAfterFindTrigger(triggerType, auth, className, objects, logTriggerSuccessBeforeHook(triggerType, className, 'AfterFind', JSON.stringify(objects), auth); request.objects = objects.map(object => { //setting the class name to transform into parse object - object.className=className; + object.className = className; return Parse.Object.fromJSON(object); }); const triggerPromise = trigger(request, response);