1
1
'use strict' ;
2
- let path = require ( 'path' ) ;
3
- let Transform = require ( 'stream' ) . Transform ;
4
- let Material = require ( 'fuller-material-file' ) ;
2
+ const path = require ( 'path' ) ;
3
+ const Transform = require ( 'stream' ) . Transform ;
4
+ const Material = require ( 'fuller-material-file' ) ;
5
5
6
- let SrcFile = function ( fuller , options ) {
6
+ const Tool = function ( fuller , options ) {
7
7
fuller . bind ( this ) ;
8
8
this . src = options . src ;
9
9
this . dst = options . dst ;
10
10
} ;
11
11
12
- SrcFile . prototype = {
12
+ Tool . prototype = {
13
13
build : function ( src , dst ) {
14
- let self = this ;
15
-
16
- let next = new Transform ( {
14
+ const next = new Transform ( {
17
15
objectMode : true ,
18
- transform : function ( mat , enc , cb ) {
19
- cb ( null , mat ) ;
20
- }
16
+ transform : ( mat , enc , cb ) => cb ( null , mat )
21
17
} ) ;
22
18
23
- process . nextTick ( function ( ) {
24
- let srcfile = path . join ( self . src , src ) ;
25
- let newMat = new Material ( {
19
+ process . nextTick ( ( ) => {
20
+ const srcfile = path . join ( this . src , src ) ;
21
+ const newMat = new Material ( {
26
22
id : dst ,
27
23
path : srcfile
28
24
} )
29
- . dst ( path . join ( self . dst , dst ) )
30
- . error ( function ( err ) {
31
- self . error ( err ) ;
32
- } ) ;
25
+ . dst ( path . join ( this . dst , dst ) )
26
+ . error ( err => this . error ( err ) ) ;
33
27
34
- self . addDependencies ( srcfile , dst ) ;
28
+ this . addDependencies ( srcfile , dst ) ;
35
29
next . write ( newMat ) ;
36
30
next . end ( ) ;
37
31
} ) ;
@@ -41,4 +35,4 @@ SrcFile.prototype = {
41
35
} ;
42
36
43
37
44
- module . exports = SrcFile ;
38
+ module . exports = Tool ;
0 commit comments