Created
October 7, 2018 17:42
-
-
Save JustinDFuller/18e1516cc0fe6b2e0c5b9535966b7bb0 to your computer and use it in GitHub Desktop.
Accept an interface of dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Normally you might do: | |
* import fs from 'fs-extra-promise' | |
* but here we will allow the user of this file to provide the fs module | |
*/ | |
export default function ({ fs }) { | |
return function(fileName) { | |
return fs.readFileAsync(fileName, 'utf8') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment