Skip to content

Use lodash implementations instead of polyfills for .values and .entries #2728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Controllers/SchemaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ export default class SchemaController {
}
})
.catch(error => {
console.error(error);
// The schema still doesn't validate. Give up
throw new Parse.Error(Parse.Error.INVALID_JSON, 'schema class name does not revalidate');
});
Expand Down
11 changes: 6 additions & 5 deletions src/LiveQuery/ParseLiveQueryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import RequestSchema from './RequestSchema';
import { matchesQuery, queryHash } from './QueryTools';
import { ParsePubSub } from './ParsePubSub';
import { SessionTokenCache } from './SessionTokenCache';
import _ from 'lodash';

class ParseLiveQueryServer {
clientId: number;
Expand Down Expand Up @@ -111,12 +112,12 @@ class ParseLiveQueryServer {
logger.debug('Can not find subscriptions under this class ' + className);
return;
}
for (let subscription of classSubscriptions.values()) {
for (let subscription of _.values(classSubscriptions)) {
let isSubscriptionMatched = this._matchesSubscription(deletedParseObject, subscription);
if (!isSubscriptionMatched) {
continue;
}
for (let [clientId, requestIds] of subscription.clientRequestIds.entries()) {
for (let [clientId, requestIds] of _.entries(subscription.clientRequestIds)) {
let client = this.clients.get(clientId);
if (typeof client === 'undefined') {
continue;
Expand Down Expand Up @@ -156,10 +157,10 @@ class ParseLiveQueryServer {
logger.debug('Can not find subscriptions under this class ' + className);
return;
}
for (let subscription of classSubscriptions.values()) {
for (let subscription of _.values(classSubscriptions)) {
let isOriginalSubscriptionMatched = this._matchesSubscription(originalParseObject, subscription);
let isCurrentSubscriptionMatched = this._matchesSubscription(currentParseObject, subscription);
for (let [clientId, requestIds] of subscription.clientRequestIds.entries()) {
for (let [clientId, requestIds] of _.entries(subscription.clientRequestIds)) {
let client = this.clients.get(clientId);
if (typeof client === 'undefined') {
continue;
Expand Down Expand Up @@ -269,7 +270,7 @@ class ParseLiveQueryServer {
this.clients.delete(clientId);

// Delete client from subscriptions
for (let [requestId, subscriptionInfo] of client.subscriptionInfos.entries()) {
for (let [requestId, subscriptionInfo] of _.entries(client.subscriptionInfos)) {
let subscription = subscriptionInfo.subscription;
subscription.deleteClientSubscription(clientId, requestId);

Expand Down
4 changes: 2 additions & 2 deletions src/Routers/ClassesRouter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import PromiseRouter from '../PromiseRouter';
import rest from '../rest';

import url from 'url';
import _ from 'lodash';

const ALLOWED_GET_QUERY_KEYS = ['keys', 'include'];

Expand Down Expand Up @@ -115,7 +115,7 @@ export class ClassesRouter extends PromiseRouter {

static JSONFromQuery(query) {
let json = {};
for (let [key, value] of Object.entries(query)) {
for (let [key, value] of _.entries(query)) {
try {
json[key] = JSON.parse(value);
} catch (e) {
Expand Down