Image links:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in index.js | |
... | |
async function handler(event, context) { | |
try { | |
return handlerService.call(event, context, { AWS }) | |
} catch (e) { | |
if (process.env.NODE_ENV === 'local') throw e | |
throw JSON.stringify(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const politicians = require('./politicians.json') | |
const promises = require('./promises.json') // live promises | |
const result = { | |
promisesWithLivePoliticians: { | |
total: 0 | |
}, | |
promisesWithOfflinePoliticians: { | |
total: 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function logDifference(arr1, arr2) { | |
let difference = arr1.filter( | |
x => arr2.indexOf(x) == -1) | |
.concat(arr2.filter( | |
x => arr1.indexOf(x) == -1) | |
); | |
if (difference.length < 1) return []; // if no difference return empty array | |
return difference; |