Skip to content

Commit

Permalink
Guard against fields not being an object yet
Browse files Browse the repository at this point in the history
  • Loading branch information
rbayliss committed May 20, 2019
1 parent 8acd79f commit f11a638
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sources/Directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ function uglify(item: Exportable) {
const exported = cloneDeep(item)
switch(item.type) {
case 'index-pattern':
exported.attributes.fields = JSON.stringify(item.attributes.fields)
// Guard against fields not being an object yet.
if(typeof exported.attributes.fields != 'string') {
exported.attributes.fields = JSON.stringify(item.attributes.fields)
}
}
return exported
}

0 comments on commit f11a638

Please sign in to comment.