From 07eeac340fbb6453b6aa73d2cad91902bab61cf8 Mon Sep 17 00:00:00 2001 From: Animesh Sahu Date: Mon, 13 Sep 2021 19:50:02 +0530 Subject: [PATCH] Exclude duplicates of widget property in docs (#276) --- gen-docs.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gen-docs.ts b/gen-docs.ts index 8258abc..e0b1955 100644 --- a/gen-docs.ts +++ b/gen-docs.ts @@ -108,13 +108,16 @@ function parseDocs(code: string) { if (possibleMatch == -1) { console.log(`Failed to find a match for "${propMatch[1].replace("-", "_")}" ~ ${JSON.stringify(matches, null, 2)} ~ ${lines[no]}`) } - const type = replaceTypeNames(matches[possibleMatch + 1]) - widgets[currentWidget].props.push({ - name: propMatch[1], - desc: propMatch[2], - type: type ?? "no-type-found" - }); + if (!widgets[currentWidget].props.some(p => p.name == propMatch[1])) { + const type = replaceTypeNames(matches[possibleMatch + 1]) + + widgets[currentWidget].props.push({ + name: propMatch[1], + desc: propMatch[2], + type: type ?? "no-type-found" + }); + } } } return widgets;