Skip to content

Commit

Permalink
refactor: file name
Browse files Browse the repository at this point in the history
  • Loading branch information
Franco Méndez committed Oct 23, 2019
1 parent 730223a commit 2953da7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
File renamed without changes.
10 changes: 4 additions & 6 deletions forward_trip_place.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ const AWS = require('aws-sdk');

const dynamoDb = new AWS.DynamoDB.DocumentClient();

function isEmpty(obj) {
return Object.keys(obj).length === 0 && obj.constructor === Object;
}

const MissingIdOnRequestError = {
statusCode: 400,
message: 'Id de trip no especificada en request'
Expand Down Expand Up @@ -35,7 +39,6 @@ module.exports.handler = function forwardTripPlace(event, context, callback) {

return dynamoDb.get(getParams, (error, getData) => {
if (error) {
console.error(error);
return callback(null, InternalServerError);
}
if (isEmpty(getData)) {
Expand All @@ -62,7 +65,6 @@ module.exports.handler = function forwardTripPlace(event, context, callback) {

return dynamoDb.put(putParams, (error) => {
if (error) {
console.error(error);
return callback(null, InternalServerError);
}

Expand All @@ -73,7 +75,3 @@ module.exports.handler = function forwardTripPlace(event, context, callback) {
});
});
};

function isEmpty(obj) {
return Object.keys(obj).length === 0 && obj.constructor === Object;
}

0 comments on commit 2953da7

Please sign in to comment.