From c246b9e0dfce95fd7a8c3fc08f94a856e42e9fbb Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Thu, 12 Oct 2017 19:48:27 -0700 Subject: [PATCH] #842 Fixes Cannot read property 'some' of undefined --- src/ExportMap.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ExportMap.js b/src/ExportMap.js index e5e772914..c330c4f1d 100644 --- a/src/ExportMap.js +++ b/src/ExportMap.js @@ -330,17 +330,19 @@ ExportMap.parse = function (path, content, context) { }) // attempt to collect module doc - ast.comments.some(c => { - if (c.type !== 'Block') return false - try { - const doc = doctrine.parse(c.value, { unwrap: true }) - if (doc.tags.some(t => t.title === 'module')) { - m.doc = doc - return true - } - } catch (err) { /* ignore */ } - return false - }) + if (ast.comments) { + ast.comments.some(c => { + if (c.type !== 'Block') return false + try { + const doc = doctrine.parse(c.value, { unwrap: true }) + if (doc.tags.some(t => t.title === 'module')) { + m.doc = doc + return true + } + } catch (err) { /* ignore */ } + return false + }) + } const namespaces = new Map()