Built motion from commit 99feb03.|0.0.140
[motion.git] / public / bower_components / lodash / lib / common / util.js
1 'use strict';
2
3 var _ = require('lodash'),
4     fs = require('fs-extra'),
5     glob = require('glob'),
6     path = require('path');
7
8 var minify = require('../common/minify.js');
9
10 /*----------------------------------------------------------------------------*/
11
12 function copyFile(srcPath, destPath) {
13   return _.partial(fs.copy, srcPath, destPath);
14 }
15
16 function globTemplate(pattern) {
17   return _.transform(glob.sync(pattern), function(result, filePath) {
18     var key = path.basename(filePath, path.extname(filePath));
19     result[key] = _.template(fs.readFileSync(filePath, 'utf8'));
20   }, {});
21 }
22
23 function minFile(srcPath, destPath) {
24   return _.partial(minify, srcPath, destPath);
25 }
26
27 function writeFile(filePath, data) {
28   return _.partial(fs.writeFile, filePath, data);
29 }
30
31 module.exports = {
32   'copyFile': copyFile,
33   'globTemplate': globTemplate,
34   'minFile': minFile,
35   'writeFile': writeFile
36 };