Skip to content

Commit 8511e4b

Browse files
committed
fix(tools): simplify syntax with a ternary
1 parent b6cfdff commit 8511e4b

File tree

1 file changed

+3
-9
lines changed
  • tools/pfe-tools/custom-elements-manifest/lib

1 file changed

+3
-9
lines changed

tools/pfe-tools/custom-elements-manifest/lib/Manifest.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,9 @@ export class Manifest {
319319
// split the demoSource into an array of parts
320320
const demoSourceParts = demoSource.split('/');
321321
// if demoSourceParts contains options.elementsDir, then build the filePath from the rootDir and the demoSource
322-
let filePath;
323-
if (demoSourceParts.includes(options.elementsDir)) {
324-
filePath =
325-
path.normalize(path.posix.join(options.rootDir, demoSource));
326-
// otherwise, build the filePath from the rootDir, options.elementsDir, and the demoSource
327-
} else {
328-
filePath =
329-
path.normalize(path.posix.join(options.rootDir, options.elementsDir, demoSource));
330-
}
322+
const filePath = demoSourceParts.includes(options.elementsDir) ?
323+
path.normalize(path.posix.join(options.rootDir, demoSource))
324+
: path.normalize(path.posix.join(options.rootDir, options.elementsDir, demoSource));
331325
const [last = ''] = filePath.split(path.sep).reverse();
332326
const filename = last.replace('.html', '');
333327
const isMainElementDemo = filename === 'index';

0 commit comments

Comments
 (0)