Skip to content

Commit 9b2b1e4

Browse files
zhhbstudiozhaohebin
andauthored
feat: use ?? instead of || (vuejs#78)
Co-authored-by: zhaohebin <[email protected]>
1 parent bc7bee8 commit 9b2b1e4

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

index.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,16 @@ async function init() {
7171
})
7272

7373
// if any of the feature flags is set, we would skip the feature prompts
74-
// use `??` instead of `||` once we drop Node.js 12 support
7574
const isFeatureFlagsUsed =
7675
typeof (
77-
argv.default ||
78-
argv.ts ||
79-
argv.jsx ||
80-
argv.router ||
81-
argv.pinia ||
82-
argv.tests ||
83-
argv.vitest ||
84-
argv.cypress ||
76+
argv.default ??
77+
argv.ts ??
78+
argv.jsx ??
79+
argv.router ??
80+
argv.pinia ??
81+
argv.tests ??
82+
argv.vitest ??
83+
argv.cypress ??
8584
argv.eslint
8685
) === 'boolean'
8786

@@ -227,7 +226,7 @@ async function init() {
227226
// so we still have to assign the default values here
228227
const {
229228
projectName,
230-
packageName = projectName || defaultProjectName,
229+
packageName = projectName ?? defaultProjectName,
231230
shouldOverwrite = argv.force,
232231
needsJsx = argv.jsx,
233232
needsTypeScript = argv.typescript,
@@ -380,7 +379,7 @@ async function init() {
380379
fs.writeFileSync(
381380
path.resolve(root, 'README.md'),
382381
generateReadme({
383-
projectName: result.projectName || defaultProjectName,
382+
projectName: result.projectName ?? defaultProjectName,
384383
packageManager,
385384
needsTypeScript,
386385
needsVitest,

0 commit comments

Comments
 (0)