Skip to content

Commit b23f09c

Browse files
committed
fix: 🐛 bind methods
1 parent ae6003a commit b23f09c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/union.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ export class Union {
6565
}
6666

6767
for (let method of SPECIAL_METHODS.values()) {
68-
// bind special methods to support
68+
// bind special methods to support
6969
// const { method } = ufs;
7070
this[method] = this[method].bind(this);
7171
}
7272
}
7373

74-
public unwatchFile(...args) {
74+
public unwatchFile = (...args) => {
7575
throw new Error("unwatchFile is not supported, please use watchFile");
7676
}
7777

78-
public watch(...args) {
78+
public watch = (...args) => {
7979
const watchers = [];
8080
for (const fs of this.fss) {
8181
try {
@@ -86,11 +86,11 @@ export class Union {
8686
}
8787
}
8888

89-
// return a proxy to call functions on these props
89+
// return a proxy to call functions on these props
9090
return createFSProxy(watchers);
9191
}
9292

93-
public watchFile(...args) {
93+
public watchFile = (...args) => {
9494
const watchers = [];
9595
for (const fs of this.fss) {
9696
try {
@@ -101,11 +101,11 @@ export class Union {
101101
}
102102
}
103103

104-
// return a proxy to call functions on these props
104+
// return a proxy to call functions on these props
105105
return createFSProxy(watchers);
106106
}
107107

108-
public existsSync(path: string) {
108+
public existsSync = (path: string) => {
109109
for (const fs of this.fss) {
110110
try {
111111
if(fs.existsSync(path)) {
@@ -119,7 +119,7 @@ export class Union {
119119
return false;
120120
};
121121

122-
public readdir(...args) {
122+
public readdir = (...args) => {
123123
let lastarg = args.length - 1;
124124
let cb = args[lastarg];
125125
if(typeof cb !== 'function') {
@@ -150,7 +150,7 @@ export class Union {
150150
}
151151
if(resArg) {
152152
result = result !== null ? result : new Set();
153-
153+
154154
// Convert all results to Strings to make sure that they're deduped
155155
for (const res of resArg) {
156156
result.add(String(res));
@@ -174,7 +174,7 @@ export class Union {
174174
iterate();
175175
};
176176

177-
public readdirSync(...args) {
177+
public readdirSync = (...args) => {
178178
let lastError: IUnionFsError = null;
179179
let result = new Set<string>();
180180
for(let i = this.fss.length - 1; i >= 0; i--) {
@@ -199,7 +199,7 @@ export class Union {
199199
return Array.from(result).sort();
200200
};
201201

202-
public createReadStream(path: string) {
202+
public createReadStream = (path: string) => {
203203
let lastError = null;
204204
for (const fs of this.fss) {
205205
try {
@@ -225,7 +225,7 @@ export class Union {
225225
throw lastError;
226226
}
227227

228-
public createWriteStream(path: string) {
228+
public createWriteStream = (path: string) => {
229229
let lastError = null;
230230
for (const fs of this.fss) {
231231
try {
@@ -251,9 +251,9 @@ export class Union {
251251

252252
/**
253253
* Adds a filesystem to the list of filesystems in the union
254-
* The new filesystem object is added as the last filesystem used
255-
* when searching for a file.
256-
*
254+
* The new filesystem object is added as the last filesystem used
255+
* when searching for a file.
256+
*
257257
* @param fs the filesystem interface to be added to the queue of FS's
258258
* @returns this instance of a unionFS
259259
*/

0 commit comments

Comments
 (0)