@@ -36,7 +36,7 @@ module.exports = class NodeWatcher extends EventEmitter {
3636
3737 this . watched = Object . create ( null ) ;
3838 this . changeTimers = Object . create ( null ) ;
39- this . dirRegistery = Object . create ( null ) ;
39+ this . dirRegistry = Object . create ( null ) ;
4040 this . root = path . resolve ( dir ) ;
4141 this . watchdir = this . watchdir . bind ( this ) ;
4242 this . register = this . register . bind ( this ) ;
@@ -57,7 +57,7 @@ module.exports = class NodeWatcher extends EventEmitter {
5757 * Register files that matches our globs to know what to type of event to
5858 * emit in the future.
5959 *
60- * Registery looks like the following:
60+ * Registry looks like the following:
6161 *
6262 * dirRegister => Map {
6363 * dirpath => Map {
@@ -79,46 +79,46 @@ module.exports = class NodeWatcher extends EventEmitter {
7979 }
8080
8181 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 ) ;
8484 }
8585
8686 const filename = path . basename ( filepath ) ;
87- this . dirRegistery [ dir ] [ filename ] = true ;
87+ this . dirRegistry [ dir ] [ filename ] = true ;
8888
8989 return true ;
9090 }
9191
9292 /**
93- * Removes a file from the registery .
93+ * Removes a file from the registry .
9494 *
9595 * @param {string } filepath
9696 * @private
9797 */
9898
9999 unregister ( filepath ) {
100100 const dir = path . dirname ( filepath ) ;
101- if ( this . dirRegistery [ dir ] ) {
101+ if ( this . dirRegistry [ dir ] ) {
102102 const filename = path . basename ( filepath ) ;
103- delete this . dirRegistery [ dir ] [ filename ] ;
103+ delete this . dirRegistry [ dir ] [ filename ] ;
104104 }
105105 }
106106
107107 /**
108- * Removes a dir from the registery .
108+ * Removes a dir from the registry .
109109 *
110110 * @param {string } dirpath
111111 * @private
112112 */
113113
114114 unregisterDir ( dirpath ) {
115- if ( this . dirRegistery [ dirpath ] ) {
116- delete this . dirRegistery [ dirpath ] ;
115+ if ( this . dirRegistry [ dirpath ] ) {
116+ delete this . dirRegistry [ dirpath ] ;
117117 }
118118 }
119119
120120 /**
121- * Checks if a file or directory exists in the registery .
121+ * Checks if a file or directory exists in the registry .
122122 *
123123 * @param {string } fullpath
124124 * @return {boolean }
@@ -128,9 +128,8 @@ module.exports = class NodeWatcher extends EventEmitter {
128128 registered ( fullpath ) {
129129 const dir = path . dirname ( fullpath ) ;
130130 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 ) ] )
134133 ) ;
135134 }
136135
@@ -211,15 +210,15 @@ module.exports = class NodeWatcher extends EventEmitter {
211210 */
212211
213212 detectChangedFile ( dir , event , callback ) {
214- if ( ! this . dirRegistery [ dir ] ) {
213+ if ( ! this . dirRegistry [ dir ] ) {
215214 return ;
216215 }
217216
218217 let found = false ;
219218 let closest = { mtime : 0 } ;
220219 let c = 0 ;
221220 // 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 ) => {
223222 fs . lstat ( path . join ( dir , file ) , ( error , stat ) => {
224223 if ( found ) {
225224 return ;
0 commit comments