ecency-mobile/src/utils/filterNsfwPost.js
2019-05-25 13:37:38 +03:00

21 lines
475 B
JavaScript

export default (posts, option) => {
const updatedPosts = [];
if (option === '1') {
posts.map(post => {
if (post.parent_permlink === 'nsfw' || post.json_metadata.tags.includes('nsfw')) {
post.nsfw = true;
}
});
return posts;
}
if (posts) {
posts.map(post => {
if (post.parent_permlink !== 'nsfw' && !post.json_metadata.tags.includes('nsfw')) {
updatedPosts.push(post);
}
});
return updatedPosts;
}
};