MCPcopy Create free account
hub / github.com/serverless/examples / promisify

Function promisify

aws-node-graphql-api-with-dynamodb/handler.js:13–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11const dynamoDb = new AWS.DynamoDB.DocumentClient();
12
13const promisify = foo => new Promise((resolve, reject) => {
14 foo((error, result) => {
15 if (error) {
16 reject(error);
17 } else {
18 resolve(result);
19 }
20 });
21});
22
23const getGreeting = firstName => promisify(callback =>
24 dynamoDb.get({

Callers 2

getGreetingFunction · 0.85
changeNicknameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected