From bca346e6162a8974c833dbf5cb37bf53a6c49c99 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Wed, 20 Nov 2013 18:56:40 +0100 Subject: [PATCH] use _.isFunction --- src/models/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/user.js b/src/models/user.js index 1cddb217be..ccfc2d6538 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -269,7 +269,7 @@ UserSchema.pre('save', function(next) { var petCount = helpers.countPets(_.reduce(this.items.pets,function(m,v){ //HOTFIX - Remove when solution is found, the first argument passed to reduce is a function - if(typeof(v) == 'function') return m; + if(_.isFunction(v)) return m; return m+(v?1:0)},0), this.items.pets); this.achievements.beastMaster = petCount >= 90;