11import type {
2+ Context ,
23 DynamoDBRecord ,
34 KinesisStreamRecord ,
45 SQSRecord ,
5- Context ,
66} from 'aws-lambda' ;
77
88const sqsRecordHandler = ( record : SQSRecord ) : string => {
@@ -45,7 +45,7 @@ const asyncKinesisRecordHandler = async (
4545
4646const dynamodbRecordHandler = ( record : DynamoDBRecord ) : object => {
4747 const body = record . dynamodb ?. NewImage ?. Message || { S : 'fail' } ;
48- if ( body [ 'S' ] ?. includes ( 'fail' ) ) {
48+ if ( body . S ?. includes ( 'fail' ) ) {
4949 throw Error ( 'Failed to process record.' ) ;
5050 }
5151
@@ -56,7 +56,7 @@ const asyncDynamodbRecordHandler = async (
5656 record : DynamoDBRecord
5757) : Promise < object > => {
5858 const body = record . dynamodb ?. NewImage ?. Message || { S : 'fail' } ;
59- if ( body [ 'S' ] ?. includes ( 'fail' ) ) {
59+ if ( body . S ?. includes ( 'fail' ) ) {
6060 throw Error ( 'Failed to process record.' ) ;
6161 }
6262
@@ -65,11 +65,11 @@ const asyncDynamodbRecordHandler = async (
6565
6666const handlerWithContext = ( record : SQSRecord , context : Context ) : string => {
6767 try {
68- if ( context . getRemainingTimeInMillis ( ) == 0 ) {
68+ if ( context . getRemainingTimeInMillis ( ) === 0 ) {
6969 throw Error ( 'No time remaining.' ) ;
7070 }
7171 } catch ( e ) {
72- throw Error ( ' Context possibly malformed. Displaying context:\n' + context ) ;
72+ throw Error ( ` Context possibly malformed. Displaying context:\n${ context } ` ) ;
7373 }
7474
7575 return record . body ;
@@ -80,11 +80,11 @@ const asyncHandlerWithContext = async (
8080 context : Context
8181) : Promise < string > => {
8282 try {
83- if ( context . getRemainingTimeInMillis ( ) == 0 ) {
83+ if ( context . getRemainingTimeInMillis ( ) === 0 ) {
8484 throw Error ( 'No time remaining.' ) ;
8585 }
8686 } catch ( e ) {
87- throw Error ( ' Context possibly malformed. Displaying context:\n' + context ) ;
87+ throw Error ( ` Context possibly malformed. Displaying context:\n${ context } ` ) ;
8888 }
8989
9090 return Promise . resolve ( record . body ) ;
0 commit comments