DEV: removes _.indexOf from codebase (#6652)

DEV: removes _.indexOf from codebase (#6652)

From 7e20a0b9173db28dff14170e299371f3a34f42b5 Mon Sep 17 00:00:00 2001
From: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Date: Thu, 22 Nov 2018 17:38:58 +0100
Subject: [PATCH] DEV: removes _.indexOf from codebase (#6652)


diff --git a/app/assets/javascripts/admin/mixins/setting-object.js.es6 b/app/assets/javascripts/admin/mixins/setting-object.js.es6
index 2a85b8a..48c9528 100644
--- a/app/assets/javascripts/admin/mixins/setting-object.js.es6
+++ b/app/assets/javascripts/admin/mixins/setting-object.js.es6
@@ -24,7 +24,9 @@ export default Ember.Mixin.create({
   }.property("valid_values"),
 
   allowsNone: function() {
-    if (_.indexOf(this.get("valid_values"), "") >= 0)
+    const validValues = this.get("valid_values");
+    if (validValues && validValues.indexOf("") >= 0) {
       return "admin.settings.none";
+    }
   }.property("valid_values")
 });

GitHub

1 Like