node-watch
Advanced tools
Comparing version 0.7.2 to 0.7.3
@@ -25,3 +25,3 @@ import { FSWatcher } from 'fs'; | ||
type EventType = 'update' | 'remove'; | ||
type Callback = (eventType ?: EventType, filePath ?: string) => any; | ||
type Callback = (eventType: EventType, filePath: string) => any; | ||
type PathName = string | Array<string>; | ||
@@ -28,0 +28,0 @@ type FilterReturn = boolean | symbol; |
@@ -40,14 +40,15 @@ var fs = require('fs'); | ||
function guard(fn) { | ||
return function(arg, action) { | ||
if (is.func(fn)) { | ||
var ret = fn(arg, SKIP_FLAG); | ||
if (ret && ret !== SKIP_FLAG) action(); | ||
if (is.func(fn)) { | ||
return function(arg, action) { | ||
if (fn(arg, false)) action(); | ||
} | ||
else if (is.regExp(fn)) { | ||
} | ||
if (is.regExp(fn)) { | ||
return function(arg, action) { | ||
if (fn.test(arg)) action(); | ||
} | ||
else { | ||
action(); | ||
} | ||
} | ||
return function(arg, action) { | ||
action(); | ||
} | ||
} | ||
@@ -54,0 +55,0 @@ |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"bugs": { | ||
@@ -17,0 +17,0 @@ "url": "https://github.com/yuanchuan/node-watch/issues" |
@@ -1,2 +0,2 @@ | ||
# node-watch [![Status](https://travis-ci.org/yuanchuan/node-watch.svg?branch=master)](https://travis-ci.org/yuanchuan/node-watch "See test builds") | ||
# node-watch [![Status](https://github.com/yuanchuan/node-watch/actions/workflows/ci.yml/badge.svg)](https://github.com/yuanchuan/node-watch/actions/workflows/ci.yml/badge.svg) | ||
@@ -3,0 +3,0 @@ A wrapper and enhancements for [fs.watch](http://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener). |
25729
706