Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Last active February 11, 2021 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FagnerMartinsBrack/ae14a1859cf201391ad4e4dcc2a7526b to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/ae14a1859cf201391ad4e4dcc2a7526b to your computer and use it in GitHub Desktop.
(Medium) Why Small Modules Matter - End Usage
const flattenArrayInsideFile = require("./flatten-array-inside-file");
flattenArrayInsideFile("file.txt")
.then(function() {
// Do something after
})
.catch(function(error) {
// Handle error
});
//async/await
try {
await flattenArrayInsideFile("file.txt");
// Do something after
} catch(error) {
// Handle error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment