Last active
October 12, 2016 19:08
-
-
Save demosifter/4e02f04fa4204f15ab45d96a8eaa6c94 to your computer and use it in GitHub Desktop.
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
module.exports = function (got) { | |
const json = got.in.data.map(d => JSON.parse(d.value)); | |
const query = got.query; | |
const threadId = query[0]; | |
let newestCount = json | |
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) | |
.shift().count; | |
return [{ | |
name: 'threads', | |
key: threadId, | |
value: { | |
// only information under the 'list' key | |
// will be propagated to the email-client-controller.js | |
list: newestCount | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment