From a4f93197b878d11503ab703a9303d317fb7304f0 Mon Sep 17 00:00:00 2001 From: Felipe Valtl de Mello Date: Fri, 13 Sep 2019 11:02:03 -0300 Subject: [PATCH] [eslint] Change hasOwnProperty to use in --- lib/DB.js | 6 +++--- lib/models.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/DB.js b/lib/DB.js index 22cadbd..937585b 100644 --- a/lib/DB.js +++ b/lib/DB.js @@ -3,11 +3,11 @@ class DB { this.sequelize = sequelize; this.models = models; } - + getModel(name) { - return this.models.hasOwnProperty(name) ? this.models[name] : null; + return name in this.models ? this.models[name] : null; } - + getModels() { return this.models; } diff --git a/lib/models.js b/lib/models.js index 148a637..0bf0f12 100644 --- a/lib/models.js +++ b/lib/models.js @@ -10,7 +10,7 @@ module.exports = { async function getFiles(paths, ignored) { const options = { nodir: true, - dot: false + dot: false, }; if (!Array.isArray(paths)) { @@ -52,7 +52,7 @@ async function applyRelations(models) { } Object.keys(models).forEach(name => { - if (models[name].hasOwnProperty('associate')) { + if ('associate' in models[name]) { models[name].associate(models); } });