diff --git a/lib/.eslintrc b/lib/.eslintrc index a7d60609..50abf59d 100644 --- a/lib/.eslintrc +++ b/lib/.eslintrc @@ -4,6 +4,9 @@ "browser": true, "es6": true, }, + "ecmaFeatures": { + "forOf": false + }, "globals": { "global": true } diff --git a/lib/objects.js b/lib/objects.js index 3d167751..e9dea027 100644 --- a/lib/objects.js +++ b/lib/objects.js @@ -25,14 +25,14 @@ function create(realmId, info) { object[keys.id] = info.id; object[keys.type] = info.type; - for (let prop of schema.properties) { + schema.properties.forEach((prop) => { let name = prop.name; props[name] = { get: util.getterForProperty(name), set: util.setterForProperty(name), }; - } + }); Object.defineProperties(object, props); diff --git a/lib/realm.js b/lib/realm.js index 4c920f88..49bdabb2 100644 --- a/lib/realm.js +++ b/lib/realm.js @@ -101,9 +101,7 @@ class Realm { rpc.commitTransaction(realmId); - for (let callback of this[listenersKey]) { - callback(this, 'change'); - } + this[listenersKey].forEach((cb) => cb(this, 'change')); } } diff --git a/lib/util.js b/lib/util.js index 71eace95..ded21bcd 100644 --- a/lib/util.js +++ b/lib/util.js @@ -28,9 +28,7 @@ function addMutationListener(realmId, callback) { function fireMutationListeners(realmId) { let listeners = mutationListeners[realmId]; if (listeners) { - for (let callback of listeners) { - callback(); - } + listeners.forEach((cb) => cb()); } } @@ -97,11 +95,11 @@ function createList(prototype, realmId, info, mutable) { function createMethods(prototype, type, methodNames, mutates) { let props = {}; - for (let name of methodNames) { + methodNames.forEach((name) => { props[name] = { value: createMethod(type, name, mutates), }; - } + }); Object.defineProperties(prototype, props); }