Skip to content

Instantly share code, notes, and snippets.

@demosifter
Last active October 12, 2016 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demosifter/4e02f04fa4204f15ab45d96a8eaa6c94 to your computer and use it in GitHub Desktop.
Save demosifter/4e02f04fa4204f15ab45d96a8eaa6c94 to your computer and use it in GitHub Desktop.
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