function getDisqusComments(threads, comment) { const { author } = comment; const thread = threads.filter(thread => thread.$['dsq:id'] === comment.thread.$['dsq:id'])[0] .id; const reply_to = comment.parent ? comment.parent.$['dsq:id'] : null; const message = toMarkdown(comment.message.trim()); const timestamp = comment.createdAt; const approved = comment.isDeleted === 'true' || comment.isSpam === 'true' ? 0 : 1; return { comment: [thread, message, reply_to, timestamp, approved], id: comment.$['dsq:id'], author: ['disqus', author.username, author.name, author.username, 0] }; }
const data = jsonObj.data; _.times(data.length, (i) => { let answer = toMarkdown(data[i].content); const reg = /<noscript>.*?<\/noscript>/g; const reg2 = /src="(.*?)"/;