index.js
/**
 * This function will remove the given or current job from the database and in-memory array
 * @param {PersistentQueue} q Instance to work with
 * @param {number} [id] Optional job id number to remove, if omitted, remove current job at front of queue
 * @return {Promise}
 */
This function will remove the given or current job from the database and in-memory array
@param {PersistentQueue} q Instance to work with
@param {number} [id] Optional job id number to remove, if omitted, remove current job at front of queue
@return {Promise}
This function will remove the given or current job from the database and in - memory array @param { PersistentQueue } q Instance to work with @param { number } [ id ] Optional job id number to remove if omitted remove current job at front of queue @return { Promise }
function removeJob(q, id) {
	if(id === undefined) {
		id = q.queue.shift().id ;
	}
	else {
		for(let i=0 ; i<q.queue.length ; i++) {
			if(q.queue[i].id === id) {
				q.queue.splice(i, 1) ;
				break ;
			}
		}
	}
	return new Promise((resolve, reject) => {
		if(q.db === null)
			reject('Open queue database before starting queue') ;
		if(q.debug) console.log('About to delete') ;
		if(q.debug) console.log('Removing job: '+id) ;
		if(q.debug) console.log('From table: '+table) ;
		if(q.debug) console.log('With queue length: '+q.length) ;
		q.db.run('DELETE FROM ' + table + ' WHERE id = ?', id, function(err) {
			if(err !== null)
				reject(err) ;
			if(this.changes) 
				resolve(id) ;
			reject('Job id '+id+' was not removed from queue') ;
		}) ;
	}) ;
}
function removeJob ( q , id ) { if ( id === undefined ) { id = q . queue . shift ( ) . id ; } else { for ( let i = 0 ; i < q . queue . length ; i ++ ) { if ( q . queue [ i ] . id === id ) { q . queue . splice ( i , 1 ) ; break ; } } } return new Promise ( ( resolve , reject ) => { if ( q . db === null ) reject ( 'Open queue database before starting queue' ) ; if ( q . debug ) console . log ( 'About to delete' ) ; if ( q . debug ) console . log ( 'Removing job: ' + id ) ; if ( q . debug ) console . log ( 'From table: ' + table ) ; if ( q . debug ) console . log ( 'With queue length: ' + q . length ) ; q . db . run ( 'DELETE FROM ' + table + ' WHERE id = ?' , id , function ( err ) { if ( err !== null ) reject ( err ) ; if ( this . changes ) resolve ( id ) ; reject ( 'Job id ' + id + ' was not removed from queue' ) ; } ) ; } ) ; }
This function will remove the given or current job from the database and in-memory array
 @param {PersistentQueue} q Instance to work with
 @param {number} [id] Optional job id number to remove, if omitted, remove current job at front of queue
 @return {Promise}
This function will remove the given or current job from the database and in - memory array @param { PersistentQueue } q Instance to work with @param { number } [ id ] Optional job id number to remove if omitted remove current job at front of queue @return { Promise }
// Search queue for id and remove if exists // Number of rows affected (0 == false)