index.js
function( userId, id ) {

		return this.memory.leaveRoom( userId, id )
		.then( function( numUsers ) {

			if( numUsers == 0 ) {

				// remove all listeners from room since there should be one
				rooms[ id ].removeAllListeners();
				rooms[ id ].setPrivate();
				delete rooms[ id ];
				
				return promise.resolve( null );
			} else {

				return promise.resolve( rooms[ id ] );
			}
		});
	}
function( userId, id ) {

		return this.memory.leaveRoom( userId, id )
		.then( function( numUsers ) {

			if( numUsers == 0 ) {

				// remove all listeners from room since there should be one
				rooms[ id ].removeAllListeners();
				rooms[ id ].setPrivate();
				delete rooms[ id ];
				
				return promise.resolve( null );
			} else {

				return promise.resolve( rooms[ id ] );
			}
		});
	}
function ( userId , id ) { return this . memory . leaveRoom ( userId , id ) . then ( function ( numUsers ) { if ( numUsers == 0 ) { // remove all listeners from room since there should be one rooms [ id ] . removeAllListeners ( ) ; rooms [ id ] . setPrivate ( ) ; delete rooms [ id ] ; return promise . resolve ( null ) ; } else { return promise . resolve ( rooms [ id ] ) ; } } ) ; }
Leave a room.

@param  {String} userId id of the user whose leaving a room
@param  {String} id id for the room you'd like to leave
@return {Promise} When this promise resolves it will return a room object if the room still exists and null if not
Leave a room .