Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sane

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sane - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

a.js

21

index.js

@@ -11,3 +11,14 @@ var fs = require('fs');

/**
* Constants
*/
var DEFAULT_DELAY = 100;
var CHANGE_EVENT = 'change';
var DELETE_EVENT = 'delete';
var ADD_EVENT = 'add';
var ALL_EVENT = 'all';
/**
* Sugar for creating a watcher.

@@ -348,2 +359,3 @@ *

this.emit(type, file, this.root);
this.emit(ALL_EVENT, type, file, this.root);
}.bind(this), DEFAULT_DELAY);

@@ -379,2 +391,3 @@ };

this.emit(type, file, this.root);
this.emit(ALL_EVENT, type, file, this.root);
};

@@ -396,11 +409,3 @@

/**
* Constants
*/
var DEFAULT_DELAY = 100;
var CHANGE_EVENT = 'change';
var DELETE_EVENT = 'delete';
var ADD_EVENT = 'add';
/**

@@ -407,0 +412,0 @@ * Traverse a directory recursively calling `callback` on every directory.

{
"name": "sane",
"version": "0.6.0",
"version": "0.7.0",
"description": "Sane aims to be fast, small, and reliable file system watcher.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,3 +16,3 @@ var os = require('os');

});
describe('sand in normal mode', function() {
describe('sane in normal mode', function() {
harness.call(this, false);

@@ -101,2 +101,29 @@ });

it('chaging, removing, deleting should emit the "all" event', function(done) {
var toChange = jo(testdir, 'file_4');
var toDelete = jo(testdir, 'file_5');
var toAdd = jo(testdir, 'file_x' + Math.floor(Math.random() * 10000));
var i = 0;
this.watcher.on('all', function(type, filepath, dir) {
assert.equal(dir, testdir);
if (type === 'change') {
assert.equal(filepath, path.relative(dir, toChange));
} else if (type === 'delete') {
assert.equal(filepath, path.relative(dir, toDelete));
} else if (type === 'add') {
assert.equal(filepath, path.relative(dir, toAdd));
}
if (++i === 3) {
done();
}
});
this.watcher.on('ready', function() {
fs.writeFileSync(toChange, 'hai');
fs.unlinkSync(toDelete);
fs.writeFileSync(toAdd, 'hai wow');
})
});
it('removing a dir will emit delete event', function(done) {

@@ -232,3 +259,2 @@ var subdir = jo(testdir, 'sub_9');

describe('sane shortcut alias', function () {
beforeEach(function () {

@@ -242,3 +268,3 @@ this.watcher = sane(testdir, '**/file_1');

it('allows for shortcut mode using just a string as glob', function (done) {
it('allows for shortcut mode using just a string as glob', function (done) {
this.watcher.on('change', function (filepath, dir) {

@@ -258,3 +284,2 @@ assert.ok(filepath.match(/file_1/));

}
}
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