@@ -78,18 +78,18 @@ which provides higher fidelity input, allowing FSTree to also detect changes.
78
78
[ walkSync.entries] ( https://github.com/joliss/node-walk-sync#entries ) .)
79
79
80
80
``` js
81
- var walkSync = require (' walk-sync' );
81
+ const walkSync = require (' walk-sync' );
82
82
83
83
// path/to/root/foo.js
84
84
// path/to/root/bar.js
85
- var current = new FSTree ({
85
+ const current = new FSTree ({
86
86
entries: walkSync .entries (' path/to/root' )
87
87
});
88
88
89
89
writeFileSync (' path/to/root/foo.js' , ' new content' );
90
90
writeFileSync (' path/to/root/baz.js' , ' new file' );
91
91
92
- var next = new FSTree ({
92
+ const next = new FSTree ({
93
93
entries: walkSync .entries (' path/to/root' )
94
94
});
95
95
@@ -196,11 +196,11 @@ They must also implement the following API:
196
196
` FSTree.fromEntries ` composes well with the output of ` walkSync.entries ` :
197
197
198
198
``` js
199
- var walkSync = require (' walk-sync' );
199
+ const walkSync = require (' walk-sync' );
200
200
201
201
// path/to/root/foo.js
202
202
// path/to/root/bar.js
203
- var current = FSTree .fromEntries (walkSync .entries (' path/to/root' ));
203
+ const current = FSTree .fromEntries (walkSync .entries (' path/to/root' ));
204
204
```
205
205
206
206
## Change Calculation
@@ -222,7 +222,7 @@ User specified `isEqual` will often want to use the default `isEqual`, so it is
222
222
Example
223
223
224
224
``` js
225
- var defaultIsEqual = FSTree .defaultIsEqual ;
225
+ const defaultIsEqual = FSTree .defaultIsEqual ;
226
226
227
227
function isEqualCheckingMeta (a , b ) {
228
228
return defaultIsEqual (a, b) && isMetaEqual (a, b);
@@ -239,9 +239,9 @@ When you want to apply changes from one tree to another easily, you can use the
239
239
` FSTree.applyPatch ` method. For example, given:
240
240
241
241
``` js
242
- var patch = oldInputTree .calculatePatch (newInputTree);
243
- var inputDir = ' src' ;
244
- var outputDir = ' dist' ;
242
+ const patch = oldInputTree .calculatePatch (newInputTree);
243
+ const inputDir = ' src' ;
244
+ const outputDir = ' dist' ;
245
245
FSTree .applyPatch (inputDir, outputDir, patch);
246
246
```
247
247
@@ -250,16 +250,16 @@ non-destructive operations (`mkdir`, `create`, `change`). If you want to calcula
250
250
and apply a patch without any intermediate operations, you can do:
251
251
252
252
``` js
253
- var inputDir = ' src' ;
254
- var outputDir = ' dist' ;
253
+ const inputDir = ' src' ;
254
+ const outputDir = ' dist' ;
255
255
oldInputTree .calculateAndApplyPatch (newInputTree, inputDir, outputDir);
256
256
```
257
257
258
258
You can optionally provide a delegate object to handle applying specific types
259
259
of operations:
260
260
261
261
``` js
262
- var createCount = 0 ;
262
+ let createCount = 0 ;
263
263
FSTree .applyPatch (inputDir, outputDir, patch, {
264
264
create : function (inputPath , outputPath , relativePath ) {
265
265
createCount++ ;
0 commit comments