Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const ids = included.indexOf(':')
? included.map(x => x.split(':')[1])
: included
const docs = fromPairs(
ids.map(id => {
return [id, client.getDocumentFromState(assoc.doctype, id)]
})
)
const missingIds = Object.keys(docs).filter(id => !docs[id])
if (!missingIds || !missingIds.length) {
return Object.values(docs)
} else {
return new QueryDefinition({ doctype: assoc.doctype, ids: missingIds })
}
}
}