Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sendToAgolia = (opts) => {
const when = opts.when
if (typeof when === "function" && !when()) {
return
}
const mdProcess = remark.use(strip)
// Flatten head
let data = cache.map((item) => {
return {
...item,
...item.head,
head: undefined,
}
})
if (opts.collectionOptions) {
data = enhanceCollection(data, opts.collectionOptions)
}
data = data.map((item) => {
item.objectID = item.__filename
item.body = mdProcess.process(item.rawBody)