lambda-utils.js
function listEventSourceMappings(lambda, params, logger) {
  logger = logger || console;
  const functionName = params.FunctionName;
  const listEventSourceMappingsAsync = Promises.wrap(lambda.listEventSourceMappings);
  const startMs = Date.now();
  return listEventSourceMappingsAsync.call(lambda, params).then(
    result => {
      if (logger.traceEnabled) {
        const mappings = Array.isArray(result.EventSourceMappings) ? result.EventSourceMappings : [];
        const n = mappings.length;
        logger.trace(`Found ${n} event source mapping${n !== 1 ? 's' : ''} for ${functionName} - took ${Date.now() - startMs} ms - result (${JSON.stringify(result)})`);
      }
      return result;
    },
    err => {
      logger.error(`Failed to list event source mappings for function (${functionName}) - took ${Date.now() - startMs} ms`, err);
      throw err;
    }
  );
}
function listEventSourceMappings(lambda, params, logger) {
  logger = logger || console;
  const functionName = params.FunctionName;
  const listEventSourceMappingsAsync = Promises.wrap(lambda.listEventSourceMappings);
  const startMs = Date.now();
  return listEventSourceMappingsAsync.call(lambda, params).then(
    result => {
      if (logger.traceEnabled) {
        const mappings = Array.isArray(result.EventSourceMappings) ? result.EventSourceMappings : [];
        const n = mappings.length;
        logger.trace(`Found ${n} event source mapping${n !== 1 ? 's' : ''} for ${functionName} - took ${Date.now() - startMs} ms - result (${JSON.stringify(result)})`);
      }
      return result;
    },
    err => {
      logger.error(`Failed to list event source mappings for function (${functionName}) - took ${Date.now() - startMs} ms`, err);
      throw err;
    }
  );
}
function listEventSourceMappings ( lambda , params , logger ) { logger = logger || console ; const functionName = params . FunctionName ; const listEventSourceMappingsAsync = Promises . wrap ( lambda . listEventSourceMappings ) ; const startMs = Date . now ( ) ; return listEventSourceMappingsAsync . call ( lambda , params ) . then ( result => { if ( logger . traceEnabled ) { const mappings = Array . isArray ( result . EventSourceMappings ) ? result . EventSourceMappings : [ ] ; const n = mappings . length ; logger . trace ( ` ${ n } ${ n !== 1 ? 's' : '' } ${ functionName } ${ Date . now ( ) - startMs } ${ JSON . stringify ( result ) } ` ) ; } return result ; } , err => { logger . error ( ` ${ functionName } ${ Date . now ( ) - startMs } ` , err ) ; throw err ; } ) ; }
Lists the event source mappings for the given function name.
@param {AWS.Lambda|AwsLambda} lambda - the AWS.Lambda instance to use
@param {ListEventSourceMappingsParams} params - the parameters to use
@param {Logger|console|undefined} [logger] - the logger to use (defaults to console if omitted)
@returns {Promise.<ListEventSourceMappingsResult>}
Lists the event source mappings for the given function name .