mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Add lib/common/util.
This commit is contained in:
18
lib/common/util.js
Normal file
18
lib/common/util.js
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var _ = require('lodash'),
|
||||
fs = require('fs-extra'),
|
||||
glob = require('glob'),
|
||||
path = require('path');
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
function globTemplate(pattern) {
|
||||
return _.transform(glob.sync(pattern), function(result, filePath) {
|
||||
result[path.basename(filePath, path.extname(filePath))] = _.template(fs.readFileSync(filePath));
|
||||
}, {});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'globTemplate': globTemplate
|
||||
};
|
||||
Reference in New Issue
Block a user