Use _.filter instead of _.reduce
This commit is contained in:
		@@ -85,14 +85,10 @@ export const typeDocUtils = {
 | 
				
			|||||||
            let entities;
 | 
					            let entities;
 | 
				
			||||||
            let packageComment = '';
 | 
					            let packageComment = '';
 | 
				
			||||||
            // HACK: We assume 1 exported class per file
 | 
					            // HACK: We assume 1 exported class per file
 | 
				
			||||||
            const numClassChildren = _.reduce(
 | 
					            const classChildren = _.filter(packageDefinitionWithMergedChildren.children, (child: TypeDocNode) => {
 | 
				
			||||||
                packageDefinitionWithMergedChildren.children,
 | 
					                return child.kindString === KindString.Class;
 | 
				
			||||||
                (sum: number, child: TypeDocNode) => {
 | 
					            });
 | 
				
			||||||
                    const nextSum = child.kindString === KindString.Class ? sum + 1 : sum;
 | 
					            if (classChildren.length > 1) {
 | 
				
			||||||
                    return nextSum;
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
            if (numClassChildren > 1) {
 | 
					 | 
				
			||||||
                throw new Error('`react-docs` only supports projects with 1 exported class per file');
 | 
					                throw new Error('`react-docs` only supports projects with 1 exported class per file');
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            const isClassExport = packageDefinitionWithMergedChildren.children[0].kindString === KindString.Class;
 | 
					            const isClassExport = packageDefinitionWithMergedChildren.children[0].kindString === KindString.Class;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user