ripunzel/curate.js

23 lines
633 B
JavaScript
Raw Normal View History

2024-09-11 03:16:53 +00:00
'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: new Date(submission.created_utc * 1000),
2024-09-11 03:16:53 +00:00
subreddit: submission.subreddit.display_name,
host: dissectLink(submission.url)
};
});
};
module.exports = curate;