Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var createOwnUserFriendsPresenceChannelGroup = function(user, friends){
var deferred = Q.defer();
var friends_presence_channels = _.map(friends, function(friend){ return "user_presence_" + friend.id });
var user_friends_presence_channel = 'friends_presence_' + user._id
pubnub.channel_group_add_channel({
callback: function(res){ deferred.resolve(res) },
error: function(res){ deferred.reject(res) },
channel_group: user_friends_presence_channel,
channel: friends_presence_channels
});
return deferred.promise;
}