* File system loader factory. * @param {object} fs - The file system interface. * @return {function} - A file loader with the following signature: * param {string} filename - The file system path to load. * param {string} filename - The file system path to load. * return {Promise} A promi
(fs)
| 109003 | * param {string} filename - The file system path to load. |
| 109004 | * return {Promise} A promise that resolves to the file contents. |
| 109005 | */ function fileLoader(fs) { |
| 109006 | return fs ? (filename)=>new Promise((accept, reject)=>{ |
| 109007 | fs.readFile(filename, (error, data)=>{ |
| 109008 | if (error) reject(error); |
| 109009 | else accept(data); |
| 109010 | }); |
| 109011 | }) : fileReject; |
| 109012 | } |
| 109013 | /** |
| 109014 | * Default file system loader that simply rejects. |
| 109015 | */ async function fileReject() { |
no test coverage detected