@@ -40,7 +40,7 @@ module.exports = function generate (name, src, dest, done) {
40
40
inPlace : dest === process . cwd ( ) ,
41
41
noEscape : true
42
42
} )
43
- opts . helpers && Object . keys ( opts . helpers ) . map ( function ( key ) {
43
+ opts . helpers && Object . keys ( opts . helpers ) . map ( key => {
44
44
Handlebars . registerHelper ( key , opts . helpers [ key ] )
45
45
} )
46
46
@@ -63,7 +63,7 @@ module.exports = function generate (name, src, dest, done) {
63
63
metalsmith . clean ( false )
64
64
. source ( '.' ) // start from template root instead of `./src` which is Metalsmith's default for `source`
65
65
. destination ( dest )
66
- . build ( function ( err , files ) {
66
+ . build ( ( err , files ) => {
67
67
done ( err )
68
68
if ( typeof opts . complete === 'function' ) {
69
69
const helpers = { chalk, logger, files }
@@ -84,7 +84,7 @@ module.exports = function generate (name, src, dest, done) {
84
84
*/
85
85
86
86
function askQuestions ( prompts ) {
87
- return function ( files , metalsmith , done ) {
87
+ return ( files , metalsmith , done ) => {
88
88
ask ( prompts , metalsmith . metadata ( ) , done )
89
89
}
90
90
}
@@ -97,7 +97,7 @@ function askQuestions (prompts) {
97
97
*/
98
98
99
99
function filterFiles ( filters ) {
100
- return function ( files , metalsmith , done ) {
100
+ return ( files , metalsmith , done ) => {
101
101
filter ( files , filters , metalsmith . metadata ( ) , done )
102
102
}
103
103
}
@@ -114,10 +114,10 @@ function renderTemplateFiles (skipInterpolation) {
114
114
skipInterpolation = typeof skipInterpolation === 'string'
115
115
? [ skipInterpolation ]
116
116
: skipInterpolation
117
- return function ( files , metalsmith , done ) {
117
+ return ( files , metalsmith , done ) => {
118
118
const keys = Object . keys ( files )
119
119
const metalsmithMetadata = metalsmith . metadata ( )
120
- async . each ( keys , function ( file , next ) {
120
+ async . each ( keys , ( file , next ) => {
121
121
// skipping files with skipInterpolation option
122
122
if ( skipInterpolation && multimatch ( [ file ] , skipInterpolation , { dot : true } ) . length ) {
123
123
return next ( )
@@ -127,7 +127,7 @@ function renderTemplateFiles (skipInterpolation) {
127
127
if ( ! / { { ( [ ^ { } ] + ) } } / g. test ( str ) ) {
128
128
return next ( )
129
129
}
130
- render ( str , metalsmithMetadata , function ( err , res ) {
130
+ render ( str , metalsmithMetadata , ( err , res ) => {
131
131
if ( err ) {
132
132
err . message = `[${ file } ] ${ err . message } `
133
133
return next ( err )
@@ -148,13 +148,11 @@ function renderTemplateFiles (skipInterpolation) {
148
148
149
149
function logMessage ( message , data ) {
150
150
if ( ! message ) return
151
- render ( message , data , function ( err , res ) {
151
+ render ( message , data , ( err , res ) => {
152
152
if ( err ) {
153
153
console . error ( '\n Error when rendering template complete message: ' + err . message . trim ( ) )
154
154
} else {
155
- console . log ( '\n' + res . split ( / \r ? \n / g) . map ( function ( line ) {
156
- return ' ' + line
157
- } ) . join ( '\n' ) )
155
+ console . log ( '\n' + res . split ( / \r ? \n / g) . map ( line => ' ' + line ) . join ( '\n' ) )
158
156
}
159
157
} )
160
158
}
0 commit comments