Files
ASHEBShop-h5/node_modules/babel-loader/lib/utils/read.js
T
2017-05-10 16:33:00 +08:00

18 lines
324 B
JavaScript

"use strict";
var fs = require("fs");
module.exports = function (cache) {
cache = cache || {};
return function (filename) {
if (!filename) {
throw new Error("filename must be a string");
}
cache[filename] = cache[filename] || fs.readFileSync(filename, "utf8");
return cache[filename];
};
};