Skip to content

Commit

Permalink
Refactor with arrify
Browse files Browse the repository at this point in the history
  • Loading branch information
es128 committed Mar 10, 2015
1 parent 44725ca commit 539d792
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ FSWatcher.prototype._remove = function(directory, item) {
// Returns an instance of FSWatcher for chaining.
FSWatcher.prototype.add = function(paths, _origAdd, _internal) {
this.closed = false;
if (!Array.isArray(paths)) paths = [paths];
paths = arrify(paths);

if (this.options.cwd) paths = paths.map(function(path) {
return sysPath.join(this.options.cwd, path);
Expand Down Expand Up @@ -413,7 +413,7 @@ FSWatcher.prototype.add = function(paths, _origAdd, _internal) {
// Returns instance of FSWatcher for chaining.
FSWatcher.prototype.unwatch = function(paths) {
if (this.closed) return this;
if (!Array.isArray(paths)) paths = [paths];
paths = arrify(paths);

paths.forEach(function(path) {
if (this._closers[path]) {
Expand Down

0 comments on commit 539d792

Please sign in to comment.