Advertisement
Guest User

Untitled

a guest
Feb 14th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export function parse (state) {
  2.  
  3.   if (state.opData.members == undefined) state.opData.members = []
  4.  
  5.   if (state.opData.groups !== undefined) {
  6.     state.opData.members = state.opData.members.concat(state.opData.groups.map((current, index, arr) => {
  7.       return {type : `group`, value : current}
  8.     }))
  9.     delete state.opData.groups
  10.   }
  11.  
  12.   if (state.opData.users !== undefined) {
  13.     state.opData.members = state.opData.members.concat(state.opData.users.map((current, index, arr) => {
  14.       return {type : `user`, value : current}
  15.     }))
  16.     delete state.opData.users
  17.   }
  18.  
  19.   if (state.opData.emails !== undefined) {
  20.     state.opData.members = state.opData.members.concat(state.opData.emails.map((current, index, arr) => {
  21.       return {type : `email`, value : current}
  22.     }))
  23.     delete state.opData.emails
  24.   }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement