From 2e4f989d7b55f0a33dd8f83afa96b2a4301be180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Tue, 4 Feb 2020 21:34:00 +0100 Subject: [PATCH] Store api members as object map instead of array. --- config/jsdoc/api/plugins/api.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/config/jsdoc/api/plugins/api.js b/config/jsdoc/api/plugins/api.js index bf8618406d..0ebda4f356 100644 --- a/config/jsdoc/api/plugins/api.js +++ b/config/jsdoc/api/plugins/api.js @@ -21,15 +21,11 @@ exports.defineTags = function(dictionary) { * from the documentation. */ -const api = []; +const api = {}; const classes = {}; const types = {}; const modules = {}; -function hasApiMembers(doclet) { - return doclet.longname.split('#')[0] == this.longname; -} - function includeAugments(doclet) { // Make sure that `observables` and `fires` are taken from an already processed `class` doclet. // This is necessary because JSDoc generates multiple doclets with the same longname. @@ -116,7 +112,7 @@ exports.handlers = { const doclet = e.doclet; if (doclet.stability) { modules[doclet.longname.split(/[~\.]/).shift()] = true; - api.push(doclet); + api[doclet.longname.split('#')[0]] = true; } if (doclet.kind == 'class') { if (!(doclet.longname in classes)) { @@ -159,7 +155,7 @@ exports.handlers = { if (doclet.isEnum || doclet.kind == 'typedef') { continue; } - if (doclet.kind == 'class' && api.some(hasApiMembers, doclet)) { + if (doclet.kind == 'class' && doclet.longname in api) { // Mark undocumented classes with documented members as unexported. // This is used in ../template/tmpl/container.tmpl to hide the // constructor from the docs.