crud.js
function find(action, req, res, cb) {
		var result = {};
		// TODO: run our query

		// clean our result
		clean(action, result, req, res, function(err) {
			if (err) {
				return cb(err);
			}

			// see if there is a method in our options that we need
			// to run once we have found our results
			if (options.found) {
				options.found(result, req, res, cb);
			} else {
				cb && cb(null, result);
			}
		});
	}
function find(action, req, res, cb) {
		var result = {};
		// TODO: run our query

		// clean our result
		clean(action, result, req, res, function(err) {
			if (err) {
				return cb(err);
			}

			// see if there is a method in our options that we need
			// to run once we have found our results
			if (options.found) {
				options.found(result, req, res, cb);
			} else {
				cb && cb(null, result);
			}
		});
	}
function find ( action , req , res , cb ) { var result = { } ; // TODO: run our query // clean our result clean ( action , result , req , res , function ( err ) { if ( err ) { return cb ( err ) ; } // see if there is a method in our options that we need // to run once we have found our results if ( options . found ) { options . found ( result , req , res , cb ) ; } else { cb && cb ( null , result ) ; } } ) ; }
Runs a query to get our result, then cleans the result
calls an optional 'found' method if it exists in the options

@author Tim Golen 2015-03-01
@access private

@param  {string} action the CRUD actions being done
@param  {object} req an Express or Restify Request object
@param  {object} res an Express or Restify Response object
@param  {Function} cb
passed an error as the first argument if it exists
passes the result as the second argument

@return {void}
Runs a query to get our result then cleans the result calls an optional found method if it exists in the options