Guest User

Untitled

a guest
Mar 18th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. const textInPostId = async (username, postId) => {
  2. const url = userPostJsonUrl(username, postId)
  3. const data = await getJsonData(url)
  4. return textInPostFromResponse(data)
  5. }
  6.  
  7. const textInPostFromResponse = (response, types = DEFAULT_TYPES) => {
  8. const paragraphs = _.get(response, 'payload.value.content.bodyModel.paragraphs', [])
  9. const filtered = paragraphs.filter(({ type }) => types.includes(type))
  10. return filtered.map(({text}) => text)
  11. }
Add Comment
Please, Sign In to add comment