question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an empty option

See original GitHub issue

I need to make a directory and I need to always have it empty. It will almost never exist, so I don’t want to run rimraf each time before making the directory. That’s a redundant fs operation.

Instead, could makeDir have an empty option? If empty is true, then an exception is thrown here:

https://github.com/sindresorhus/make-dir/blob/6d029fe1f75f1a02fcdd7a67f34eadf0941a424f/index.js#L90-L93

Or alternatively, some option that doesn’t silence the EEXIST exceptions. Like opts.throwOnExists

A third possible solution could be that makeDir returns something that tells us if the directory already existed. Like it could return { alreadyExisted: true }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
papbcommented, Apr 24, 2020
0reactions
zkochancommented, Apr 24, 2020

I guess I will create a new package for this. This one is not that useful anymore, as NodeJS supports recursive mkdir natively

Read more comments on GitHub >

github_iconTop Results From Across the Web

default select option as blank - html - Stack Overflow
So after the user selected an option, the empty option disappears. Save this answer. Show activity on this post.
Read more >
Should a blank option always be included in <select> inputs?
As you have suggested, I would recommend in the instance of a required field, that you don't have the "please select" option when...
Read more >
Add an empty space option to a dropdown menu in Google ...
Check out my course! https://yagisanatode.teachable.com/p/google-sheets/In this tutorial, you will learn how to create an empty option to a ...
Read more >
Why does AngularJS include an empty option in select
After a value is selected, the drop-down gets back to its default state. However, while working with the AngularJS dropdown, it was observed ......
Read more >
How do I add an empty first field in a dropdown menu?
I have a dropdown menu that I am populating it with data from my db. I am also using jQuery Chosen: https://harvesthq.github.io/chosen/ The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found