Explorar el Código

Use "Object.keys" instead of "for"

Norio Suzuki hace 8 años
padre
commit
1a7596caf4
Se han modificado 1 ficheros con 3 adiciones y 5 borrados
  1. 3 5
      lib/routes/me.js

+ 3 - 5
lib/routes/me.js

@@ -98,11 +98,9 @@ module.exports = function(crowi, app) {
 
         userData.update(name, email, lang, (err, userData) => {
           if (err) {
-            for (var e in err.errors) {
-              if (err.errors.hasOwnProperty(e)) {
-                req.form.errors.push(err.errors[e].message);
-              }
-            }
+            Object.keys(err.errors).forEachh((e) => {
+              req.form.errors.push(err.errors[e].message);
+            });
             return res.render('me/index', {});
           }