Skip to content

Instantly share code, notes, and snippets.

@hmpmarketing
Last active January 16, 2018 10:51
Show Gist options
  • Select an option

  • Save hmpmarketing/796a6afcf7181d0363d48fd3c02d6922 to your computer and use it in GitHub Desktop.

Select an option

Save hmpmarketing/796a6afcf7181d0363d48fd3c02d6922 to your computer and use it in GitHub Desktop.
async function has(id) {
const val = await cache.has(`actioncookiecap-${id}`);
return { val, id };
}
actionFilter.filterVisited = async function (actions) {
const results = await Promise.all(actions.map(has));
console.log(results) //Returns [ { val: false, id: 39708 }, { val: false, id: 39709 } ]
return results.filter(v => v.val).map(v => v.id);
}
actionFilter.filterVisited(actions).then(function(a){
console.log(a) //return [] ??
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment