Skip to content

Instantly share code, notes, and snippets.

@rbren
Last active September 21, 2017 16:55
Show Gist options
  • Save rbren/b1ce2b9b3ef1767e7629f082c31d3ef8 to your computer and use it in GitHub Desktop.
Save rbren/b1ce2b9b3ef1767e7629f082c31d3ef8 to your computer and use it in GitHub Desktop.
function readFilePromise(filename) {
if (!filename) {
return Promise.reject(new Error("Filename not specified"));
}
if (filename === 'index.html') {
return Promise.resolve('<h1>Hello!</h1>');
}
return new Promise((resolve, reject) => {/*...*/})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment