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

jsDAV

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsDAV - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

lib/DAV/plugins/cors.js

62

lib/shared/base.js

@@ -8,10 +8,40 @@ /* vim:set ts=4 sw=4 sts=4 expandtab */

var UUID = 0;
var UUID_INCR = 0;
function binarySearchBitshift(list, val) {
var min = 0;
var max = list.length - 1;
for(;;) {
// fall back to linear search, 11 seems to be a good threshold, but this
// depends on the uses comparator!! (here: ===)
if (min + 11 > max) {
for (var i = min; i <= max; ++i) {
if (val === list[i]) {
return i;
}
}
return -1;
}
var mid = (min + max) >> 1;
var dat = list[mid];
if (val === dat)
return mid;
if (val > dat)
min = mid + 1;
else
max = mid - 1;
}
};
var Base = module.exports = Object.freeze(Object.create(Object.prototype, {
UUID: {
value: UUID
value: UUID_INCR
},
UUIDS: {
value: [UUID]
value: [UUID_INCR]
},

@@ -78,7 +108,7 @@ /**

var descriptor = {};
var uuids = this.UUIDS || [this.UUID || 0];
var base = 0;
var uuids = Array.isArray(this.UUIDS) ? [].concat(this.UUIDS) : [this.UUID];
Array.prototype.forEach.call(arguments, function(properties) {
// Make sure the merged-in object has a UUID
if (!properties.hasOwnProperty("UUID")) {
properties.UUID = base | 1 << ++UUID;
properties.UUID = ++UUID_INCR;
if (!properties.UUIDS)

@@ -88,5 +118,12 @@ properties.UUIDS = [];

}
// Copy the object properties over
Object.getOwnPropertyNames(properties).forEach(function(name) {
if (name == "UUIDS")
uuids = uuids.concat(properties[name]);
if (name == "UUIDS") {
properties[name].forEach(function(uuid) {
if (binarySearchBitshift(uuids, uuid) == -1)
uuids.push(uuid);
});
// Keep the list sorted at all times (binary search)
uuids.sort(function (a, b) { return a - b; });
}
else

@@ -96,8 +133,3 @@ descriptor[name] = Object.getOwnPropertyDescriptor(properties, name);

});
uuids.forEach(function(uuid) {
if (base & uuid)
return;
base = base | uuid;
});
base = base || (base | 1 << ++UUID);
var base = ++UUID_INCR;
descriptor.UUID = {

@@ -228,5 +260,5 @@ value: base

value: function hasFeature(base) {
return typeof base.UUID != "undefined" && this.UUIDS.indexOf(base.UUID) !== -1;
return typeof base.UUID != "undefined" && binarySearchBitshift(this.UUIDS, base.UUID) != -1;
}
}
}));
{
"name": "jsDAV",
"description": "jsDAV allows you to easily add WebDAV support to a NodeJS application. jsDAV is meant to cover the entire standard, and attempts to allow integration using an easy to understand API.",
"version": "0.3.1",
"version": "0.3.2",
"homepage" : "http://github.com/mikedeboer/jsDAV",

@@ -19,12 +19,12 @@ "engines": {"node": ">= 0.4.0"},

"formidable": "~1.0.11",
"jsftp": "~0.5.4",
"node-sftp": "0.1.1",
"xmldom": "~0.1.13",
"xpath": "~0.0.5",
"gnu-tools": "0.0.x"
"xpath": "~0.0.5"
},
"optionalDependencies": {
"jsftp": "~0.5.4",
"node-sftp": "0.1.1",
"dbox": "~0.5.6",
"redis": "~0.8.2",
"mongodb": "~1.2.12"
"mongodb": "~1.2.12",
"gnu-tools": "0.0.x"
},

@@ -31,0 +31,0 @@ "licenses": [{

@@ -8,3 +8,3 @@ var Assert = require("assert");

// interfaces for directories:
var jsDAV_Directory = require("./../lib/DAV/directory");
var jsDAV_Collection = require("./../lib/DAV/collection");
var jsDAV_iQuota = require("./../lib/DAV/interfaces/iQuota");

@@ -22,3 +22,3 @@ var jsDAV_iCollection = require("./../lib/DAV/interfaces/iCollection");

var dir = jsDAV_FS_Directory.new("somepath/to/a/dir");
Assert.ok(dir.hasFeature(jsDAV_Directory));
Assert.ok(dir.hasFeature(jsDAV_Collection));
Assert.ok(dir.hasFeature(jsDAV_iQuota));

@@ -36,3 +36,3 @@ Assert.ok(dir.hasFeature(jsDAV_iCollection));

Assert.ok(!file.hasFeature(jsDAV_Directory));
Assert.ok(!file.hasFeature(jsDAV_Collection));
Assert.ok(!file.hasFeature(jsDAV_iQuota));

@@ -43,3 +43,3 @@ Assert.ok(!file.hasFeature(jsDAV_iCollection));

// re-test dir properties
Assert.ok(dir.hasFeature(jsDAV_Directory));
Assert.ok(dir.hasFeature(jsDAV_Collection));
Assert.ok(dir.hasFeature(jsDAV_iQuota));

@@ -46,0 +46,0 @@ Assert.ok(dir.hasFeature(jsDAV_iCollection));

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