'use strict';
const R = require('ramda');
const splitAndParse = R.compose(R.defaultTo(null), parseInt, R.takeLast(1), R.split('.'), String);
module.exports = tuple => {
const author = tuple[1];
Eif(author.name) {
const xAuthor = R.evolve({imageUrl: R.replace('http://www', 'https://is')}, author);
const retAuthor = R.assoc('type', 'author', R.pick([
'name',
'url',
'imageUrl',
'twitterId',
'description',
'id'
], xAuthor));
return Array.of(R.merge({
"type": "author",
"id": author.id
}, tuple[0]),
R.evolve({id: splitAndParse},retAuthor)
);
}
}; |