Skip to content

Commit c246b9e

Browse files
import-js#842 Fixes Cannot read property 'some' of undefined
1 parent 1958e0b commit c246b9e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Diff for: src/ExportMap.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -330,17 +330,19 @@ ExportMap.parse = function (path, content, context) {
330330
})
331331

332332
// attempt to collect module doc
333-
ast.comments.some(c => {
334-
if (c.type !== 'Block') return false
335-
try {
336-
const doc = doctrine.parse(c.value, { unwrap: true })
337-
if (doc.tags.some(t => t.title === 'module')) {
338-
m.doc = doc
339-
return true
340-
}
341-
} catch (err) { /* ignore */ }
342-
return false
343-
})
333+
if (ast.comments) {
334+
ast.comments.some(c => {
335+
if (c.type !== 'Block') return false
336+
try {
337+
const doc = doctrine.parse(c.value, { unwrap: true })
338+
if (doc.tags.some(t => t.title === 'module')) {
339+
m.doc = doc
340+
return true
341+
}
342+
} catch (err) { /* ignore */ }
343+
return false
344+
})
345+
}
344346

345347
const namespaces = new Map()
346348

0 commit comments

Comments
 (0)