Use Prettier JS (#5017)

* Adds prettier

* Run lint before tests
This commit is contained in:
Florent Vilmart
2018-09-01 13:58:06 -04:00
committed by GitHub
parent 189cd259ee
commit d83a0b6808
240 changed files with 41098 additions and 29020 deletions

View File

@@ -4,11 +4,16 @@ var Parse = require('parse/node').Parse;
// Returns a promise that fulfills iff this user id is valid.
function validateAuthData(authData) {
return graphRequest('me?access_token=' + authData.access_token).then(function (data) {
return graphRequest('me?access_token=' + authData.access_token).then(function(
data
) {
if (data && data.openid == authData.id) {
return;
}
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq auth is invalid for this user.');
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
'qq auth is invalid for this user.'
);
});
}
@@ -19,18 +24,23 @@ function validateAppId() {
// A promisey wrapper for qq graph requests.
function graphRequest(path) {
return httpsRequest.get('https://graph.qq.com/oauth2.0/' + path, true).then((data) => {
return parseResponseData(data);
});
return httpsRequest
.get('https://graph.qq.com/oauth2.0/' + path, true)
.then(data => {
return parseResponseData(data);
});
}
function parseResponseData(data) {
const starPos = data.indexOf("(");
const endPos = data.indexOf(")");
if(starPos == -1 || endPos == -1){
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq auth is invalid for this user.');
const starPos = data.indexOf('(');
const 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);
return JSON.parse(data);
}