busterc / assert-dotenv Goto Github PK
View Code? Open in Web Editor NEW:warning: One fell swoop for loading and asserting environment settings in node.
:warning: One fell swoop for loading and asserting environment settings in node.
fs.exists is considered an antipattern and is documented as a potential deprecation in the documentation. It seems like it should be possible to just do the read and handle the error appropriately.
I personally find that a bit funky although it likely makes sense in this particular use case.
The client code would be a lot cleaner if this could be done synchronously rather that async as there would be no need for a callback. There are also cases where different runners (e.g., gulp, mocha) seem to expect things to be run immediately and they register nextTick handlers to process their stuff. This doesn't work with the async callback.
It should be possible to switch this to a synchronous API using the fs.*Sync
calls. find-parent-dir
also offers a synchronous API that can be used.
The expected result of this would be changing this:
require('assert-dotenv')({}, function() {
// some code
});
into this:
require('assert-dotenv')({});
// some code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.