Skip to content

Commit

Permalink
fix: add default value for possible undefined object
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed Jun 21, 2024
1 parent d0f759d commit e385fd2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/actions/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import {
*
* @param {Record<"examples", boolean>} options Command options with flags, like `--e`
*/
export async function initAction(options) {
export async function initAction(options = { examples: false }) {
/*
* Global Config
*/

compose(getConfigFilePath(options.examples), createFileIfNotExists)
compose(getConfigFilePath(options?.examples), createFileIfNotExists)

/*
* Preset Folder
*/

compose(
checkIfPresetFolderAlreadyExists(options.examples),
checkIfPresetFolderAlreadyExists(options?.examples),
createPresetFolderIfNotExists,
createPresetsFolderAssets
)
Expand All @@ -36,7 +36,7 @@ export async function initAction(options) {
*/

compose(
checkIfTemplateFolderAlreadyExists(options.examples),
checkIfTemplateFolderAlreadyExists(options?.examples),
createTemplateFolderIfNotExists,
createTemplateFolderAssets
)
Expand Down

0 comments on commit e385fd2

Please sign in to comment.