Skip to content

Instantly share code, notes, and snippets.

@irzhywau
Created June 21, 2019 16:15
Show Gist options
  • Save irzhywau/2a0ab4458bfa703ecddc779dfc8f2775 to your computer and use it in GitHub Desktop.
Save irzhywau/2a0ab4458bfa703ecddc779dfc8f2775 to your computer and use it in GitHub Desktop.
Formatting data
// inside the formatter method
parallel(_map(item.fields, (field: any) => {
return (callback: Function) => {
let value: any = null;
switch (field.type) {
case 'category':
value = _map(field.values, (val: any) => { return { id: val.value.id, text: val.value.text } });
break;
case 'image':
value = _map(field.values, (val: any) => val.value.link);
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment