@@ -36,7 +36,7 @@ module.exports = class NodeWatcher extends EventEmitter {
36
36
37
37
this . watched = Object . create ( null ) ;
38
38
this . changeTimers = Object . create ( null ) ;
39
- this . dirRegistery = Object . create ( null ) ;
39
+ this . dirRegistry = Object . create ( null ) ;
40
40
this . root = path . resolve ( dir ) ;
41
41
this . watchdir = this . watchdir . bind ( this ) ;
42
42
this . register = this . register . bind ( this ) ;
@@ -57,7 +57,7 @@ module.exports = class NodeWatcher extends EventEmitter {
57
57
* Register files that matches our globs to know what to type of event to
58
58
* emit in the future.
59
59
*
60
- * Registery looks like the following:
60
+ * Registry looks like the following:
61
61
*
62
62
* dirRegister => Map {
63
63
* dirpath => Map {
@@ -79,46 +79,46 @@ module.exports = class NodeWatcher extends EventEmitter {
79
79
}
80
80
81
81
const dir = path . dirname ( filepath ) ;
82
- if ( ! this . dirRegistery [ dir ] ) {
83
- this . dirRegistery [ dir ] = Object . create ( null ) ;
82
+ if ( ! this . dirRegistry [ dir ] ) {
83
+ this . dirRegistry [ dir ] = Object . create ( null ) ;
84
84
}
85
85
86
86
const filename = path . basename ( filepath ) ;
87
- this . dirRegistery [ dir ] [ filename ] = true ;
87
+ this . dirRegistry [ dir ] [ filename ] = true ;
88
88
89
89
return true ;
90
90
}
91
91
92
92
/**
93
- * Removes a file from the registery .
93
+ * Removes a file from the registry .
94
94
*
95
95
* @param {string } filepath
96
96
* @private
97
97
*/
98
98
99
99
unregister ( filepath ) {
100
100
const dir = path . dirname ( filepath ) ;
101
- if ( this . dirRegistery [ dir ] ) {
101
+ if ( this . dirRegistry [ dir ] ) {
102
102
const filename = path . basename ( filepath ) ;
103
- delete this . dirRegistery [ dir ] [ filename ] ;
103
+ delete this . dirRegistry [ dir ] [ filename ] ;
104
104
}
105
105
}
106
106
107
107
/**
108
- * Removes a dir from the registery .
108
+ * Removes a dir from the registry .
109
109
*
110
110
* @param {string } dirpath
111
111
* @private
112
112
*/
113
113
114
114
unregisterDir ( dirpath ) {
115
- if ( this . dirRegistery [ dirpath ] ) {
116
- delete this . dirRegistery [ dirpath ] ;
115
+ if ( this . dirRegistry [ dirpath ] ) {
116
+ delete this . dirRegistry [ dirpath ] ;
117
117
}
118
118
}
119
119
120
120
/**
121
- * Checks if a file or directory exists in the registery .
121
+ * Checks if a file or directory exists in the registry .
122
122
*
123
123
* @param {string } fullpath
124
124
* @return {boolean }
@@ -128,9 +128,8 @@ module.exports = class NodeWatcher extends EventEmitter {
128
128
registered ( fullpath ) {
129
129
const dir = path . dirname ( fullpath ) ;
130
130
return (
131
- this . dirRegistery [ fullpath ] ||
132
- ( this . dirRegistery [ dir ] &&
133
- this . dirRegistery [ dir ] [ path . basename ( fullpath ) ] )
131
+ this . dirRegistry [ fullpath ] ||
132
+ ( this . dirRegistry [ dir ] && this . dirRegistry [ dir ] [ path . basename ( fullpath ) ] )
134
133
) ;
135
134
}
136
135
@@ -211,15 +210,15 @@ module.exports = class NodeWatcher extends EventEmitter {
211
210
*/
212
211
213
212
detectChangedFile ( dir , event , callback ) {
214
- if ( ! this . dirRegistery [ dir ] ) {
213
+ if ( ! this . dirRegistry [ dir ] ) {
215
214
return ;
216
215
}
217
216
218
217
let found = false ;
219
218
let closest = { mtime : 0 } ;
220
219
let c = 0 ;
221
220
// eslint-disable-next-line unicorn/no-array-for-each
222
- Object . keys ( this . dirRegistery [ dir ] ) . forEach ( ( file , i , arr ) => {
221
+ Object . keys ( this . dirRegistry [ dir ] ) . forEach ( ( file , i , arr ) => {
223
222
fs . lstat ( path . join ( dir , file ) , ( error , stat ) => {
224
223
if ( found ) {
225
224
return ;
0 commit comments