23 lines
623 B
JavaScript
23 lines
623 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const dissectLink = require('./dissectLink.js');
|
||
|
|
||
|
function curate(submissions) {
|
||
|
return submissions.map((submission, index) => {
|
||
|
return {
|
||
|
id: submission.id,
|
||
|
index: index,
|
||
|
title: submission.title,
|
||
|
text: submission.selftext,
|
||
|
user: submission.author.name,
|
||
|
permalink: submission.permalink,
|
||
|
url: submission.url,
|
||
|
datetime: submission.created_utc * 1000,
|
||
|
subreddit: submission.subreddit.display_name,
|
||
|
host: dissectLink(submission.url)
|
||
|
};
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports = curate;
|