We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 227a6c0 commit ae661fbCopy full SHA for ae661fb
sample-apps/layer-typescript/function/index.ts
@@ -0,0 +1,28 @@
1
+import { Handler } from 'aws-lambda';
2
+import * as _ from 'lodash';
3
+
4
+type User = {
5
+ user: string;
6
+ active: boolean;
7
+}
8
9
+type UserResult = {
10
+ statusCode: number;
11
+ body: string;
12
13
14
+const users: User[] = [
15
+ { 'user': 'Carlos', 'active': true },
16
+ { 'user': 'Gil-dong', 'active': false },
17
+ { 'user': 'Pat', 'active': false }
18
+];
19
20
+export const handler: Handler<any, UserResult> = async (): Promise<UserResult> => {
21
22
+ let out = _.findLastIndex(users, (user: User) => { return user.user == 'Pat'; });
23
+ const response = {
24
+ statusCode: 200,
25
+ body: JSON.stringify(out + ", " + users[out].user),
26
+ };
27
+ return response;
28
+};
0 commit comments