Skip to content

Instantly share code, notes, and snippets.

@JustinDFuller
Created October 7, 2018 17:42
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 JustinDFuller/18e1516cc0fe6b2e0c5b9535966b7bb0 to your computer and use it in GitHub Desktop.
Save JustinDFuller/18e1516cc0fe6b2e0c5b9535966b7bb0 to your computer and use it in GitHub Desktop.
Accept an interface of dependencies
/**
* 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