Socket
Socket
Sign inDemoInstall

node-watch

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-watch - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

24

lib/watch.js

@@ -12,3 +12,3 @@ /**

*/
var is = (function(ret) {
var is = function(ret) {
var shortcuts = {

@@ -30,3 +30,3 @@ 'file': 'File'

return ret;
}({}));
}({});

@@ -70,3 +70,3 @@

*/
var memo = (function(memo) {
var memo = function(memo) {
return {

@@ -77,3 +77,3 @@ push: function(name, type) {

has: function(name) {
return memo.hasOwnProperty(name) ? true : false;
return {}.hasOwnProperty.call(memo, name);
},

@@ -87,3 +87,3 @@ update: function(name) {

};
}({}));
}({});

@@ -94,3 +94,3 @@

*/
var fileNameCache = (function(cache) {
var fileNameCache = function(cache) {
return {

@@ -113,3 +113,3 @@ push: function(name) {

};
}({}));
}({});

@@ -120,3 +120,3 @@

*/
var worker = (function() {
var worker = function() {
var free = true;

@@ -134,3 +134,3 @@ return {

}
}());
}();

@@ -188,4 +188,4 @@

//handle multiple files.
args[0].forEach(function(item) {
origin.apply(null, [item].concat(args.slice(1)));
args[0].forEach(function(path) {
origin.apply(null, [path].concat(args.slice(1)));
});

@@ -206,3 +206,3 @@ }

* `followSymLinks`: Follow symbolic links or not (defaults to false).
* `maxSymLevel`: The max number of following symbolic links (defaults to 3).
* `maxSymLevel`: The max number of following symbolic links (defaults to 1).
*

@@ -209,0 +209,0 @@ * Example:

{
"name": "node-watch"
, "version": "0.3.1"
, "version": "0.3.2"
, "description": "fs.watch() wrapper of Nodejs "

@@ -5,0 +5,0 @@ , "url": "https://github.com/yuanchuan/node-watch"

@@ -11,4 +11,2 @@ #Node-watch

### Example

@@ -26,9 +24,7 @@

* Some editors will generate temporary files which will cause the callback function to trigger multiple times.
* when watching a single file, the callback function will only be triggered one time and then the file is unwatched.
* Some editors will generate temporary files which will cause the callback function to be triggered multiple times.
* when watching a single file the callback function will only be triggered one time and then is seem to be unwatched.
* Missing an option to watch a directory recursively.
### The difference

@@ -38,5 +34,4 @@ This module **currently** does not differentiate event like `rename` or `delete`. Once there is a change, the callback function will be triggered.

### Options
## Options
`recursive`:Watch it recursively or not (defaults to **true**).

@@ -55,7 +50,6 @@

##FAQ
###FAQ
#### 1. How to watch mutiple files or directories
### 1. How to watch mutiple files or directories.
```js

@@ -67,5 +61,5 @@ watch(['file1', 'file2'], function(file) {

### 2. How to filter files
#### 2. How to filter files
Write your own filter function as a high order function. For example:
Write your own filter function as a higher-order function. For example:

@@ -76,3 +70,3 @@ ```js

if (pattern.test(filename)) {
fn(filename):
fn(filename);
}

@@ -84,4 +78,4 @@ }

watch('mydir', filter(/\.js$/, function(filename) {
//
}));
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc