From f89152b45d8e1fa152940492d7ec1ae1da77d718 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 e5e7729141..c330c4f1d5 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()