Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
content = post.description[0]
if (post['content:encoded'])
content = post['content:encoded'][0]
if (post['pubDate'])
published_at = post['pubDate'][0]
if (post['atom:updated'])
modified_at = post['atom:updated'][0]
if (post['category'])
categories = post['category']
if (post['dc:creator'])
created_by = post['dc:creator'][0]
if (post['link'])
medium_link = post['link'][0]
// Test if object available
var slug = slugify(title).toLowerCase();
Cosmic.getObject(cosmic_config, { slug: slug }, function(err, response) {
if (response && response.object) {
// already added
return callback()
} else {
var params = {
title: title,
slug: slug,
content: content,
type_slug: 'posts',
write_key: config.bucket.write_key,
metafields: [
{
key: 'published_at',
title: 'Published At',
value: published_at
},
schedule.scheduleJob(time, function(){
Cosmic.getObject(config, {slug: itemSlug}, function(error, response){
if(response.object.metadata.date == new Date(time).toISOString()){
bot.say(BotUserId, response.object.title)
console.log('firing reminder')
} else {
eventEmitter.emit('new', response.object.slug, response.object.metafield.date.value)
console.log('times do not match checking again at '+response.object.metadata.date)
}
})
})
})
app.get('/api/config', (req,res) => {
Cosmic.getObject(config, { slug: 'site-config' }, (err, response) => {
const data = response.object.metadata
err ? res.status(500).json({ data: 'error' }) : res.json({ data })
})
})
}).then((answers)=>{
if(answers.allnotes === "\u001b[33mReturn\u001b[39m"){
MainMenu()
return;
}
var regexSearch = /(\w{17})/
var newvalue = answers.allnotes.match(regexSearch)
Cosmic.getObject(config, {slug: newvalue[0]}, (error, response)=>{
inquirer.prompt({
type: 'expand',
message: chalk.blue(response.object.title),
name: 'morecontext',
choices: [
{
key: 'e',
name: 'Edit',
value: 'edit'
},
{
key: 'd',
name: 'Delete',
value: 'delete'
},
{