saulx-murmur
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -1,21 +0,15 @@ | ||
/* expose pure incremental api */ | ||
"use strict"; | ||
module.exports = (() => { | ||
try { | ||
const murmur = require("./builds/incremental/" + | ||
process.platform + | ||
"_" + | ||
process.arch + | ||
"_" + | ||
process.versions.modules + | ||
".node"); | ||
const getBuild = () => { | ||
const murmur = require("./builds/incremental/" + | ||
process.platform + | ||
"_" + | ||
process.arch + | ||
"_" + | ||
process.versions.modules + | ||
".node"); | ||
return murmur; | ||
} catch (e) { | ||
throw new Error( | ||
"This version of murmur is not compatible with your Node.js build:\n\n" + | ||
e.toString() | ||
); | ||
} | ||
})(); | ||
return murmur; | ||
}; | ||
module.exports = getBuild(); |
45
index.js
"use strict"; | ||
module.exports = (() => { | ||
try { | ||
const murmur = require("./builds/" + | ||
process.platform + | ||
"_" + | ||
process.arch + | ||
"_" + | ||
process.versions.modules + | ||
".node"); | ||
return murmur; | ||
} catch (e) { | ||
const fs = require("fs"); | ||
const pathResolve = require("path").resolve; | ||
const { execSync } = require("child_process"); | ||
let murmur; | ||
console.log( | ||
"Cannot use prebuilt Murmur version. Falling back to murmurhash-native." | ||
); | ||
// check for murmurhash-native without adding it to the require cache | ||
module.paths.forEach((path) => { | ||
if (fs.existsSync(pathResolve(path, "murmurhash-native")) === true) { | ||
murmur = require("murmurhash-native"); | ||
} | ||
}); | ||
if (!murmur) { | ||
console.log("Installing murmurhash-native"); | ||
execSync("npm install murmurhash-native"); | ||
murmur = require("murmurhash-native"); | ||
} | ||
return murmur; | ||
} | ||
})(); | ||
const getBuild = () => { | ||
const murmur = require("./builds/" + | ||
process.platform + | ||
"_" + | ||
process.arch + | ||
"_" + | ||
process.versions.modules + | ||
".node"); | ||
return murmur; | ||
}; | ||
module.exports = getBuild(); |
@@ -6,6 +6,6 @@ /* from nodejs lib/internal/streams/lazy_transform.js */ | ||
// for the stream, one conventional and one non-conventional. | ||
"use strict"; | ||
'use strict'; | ||
var stream = require("stream"); | ||
var util = require("util"); | ||
var stream = require('stream'); | ||
var util = require('util'); | ||
@@ -19,7 +19,7 @@ module.exports = LazyTransform; | ||
["_readableState", "_writableState", "_transformState"].forEach(function( | ||
prop, | ||
i, | ||
props | ||
) { | ||
[ | ||
'_readableState', | ||
'_writableState', | ||
'_transformState' | ||
].forEach(function(prop, i, props) { | ||
Object.defineProperty(LazyTransform.prototype, prop, { | ||
@@ -29,3 +29,3 @@ get: function() { | ||
this._writableState.decodeStrings = false; | ||
this._writableState.defaultEncoding = "binary"; | ||
this._writableState.defaultEncoding = 'binary'; | ||
return this[prop]; | ||
@@ -45,1 +45,2 @@ }, | ||
}); | ||
{ | ||
"name": "saulx-murmur", | ||
"description": "prebuild murmur for node modules v72 and x64 architecture", | ||
"version": "0.2.3", | ||
"description": "prebuild murmur native", | ||
"version": "0.3.0", | ||
"main": "./index.js", | ||
"dependencies": { | ||
"nan": "^2.14.1" | ||
}, | ||
"scripts": { | ||
@@ -7,0 +10,0 @@ "test": "node test/index.js" |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports.getHashes = function() { | ||
exports.getHashes = function () { | ||
return Object.keys(binding) | ||
.filter(function(name) { | ||
.filter(function (name) { | ||
return "function" === typeof binding[name]; | ||
}) | ||
.map(function(name) { | ||
.map(function (name) { | ||
return name.toLowerCase(); | ||
@@ -18,3 +18,3 @@ }); | ||
Object.keys(binding).forEach(function(name) { | ||
Object.keys(binding).forEach(function (name) { | ||
if (binding.hasOwnProperty(name) && "function" === typeof binding[name]) { | ||
@@ -84,3 +84,3 @@ algorithms[name.toLowerCase()] = binding[name]; | ||
MurmurHash.prototype._transform = function(chunk, encoding, callback) { | ||
MurmurHash.prototype._transform = function (chunk, encoding, callback) { | ||
if (chunk.length < 8192) { | ||
@@ -95,3 +95,3 @@ // this constant was chosen experimentally | ||
MurmurHash.prototype._flush = function(callback) { | ||
MurmurHash.prototype._flush = function (callback) { | ||
this.push(this._handle.digest()); | ||
@@ -101,3 +101,3 @@ callback(); | ||
MurmurHash.prototype.update = function() { | ||
MurmurHash.prototype.update = function () { | ||
var handle = this._handle; | ||
@@ -107,3 +107,3 @@ return handle.update.apply(handle, arguments) && this; | ||
MurmurHash.prototype.digest = function() { | ||
MurmurHash.prototype.digest = function () { | ||
var handle = this._handle; | ||
@@ -113,7 +113,7 @@ return handle.digest.apply(handle, arguments); | ||
MurmurHash.prototype.serialize = function(type, offset) { | ||
MurmurHash.prototype.serialize = function (type, offset) { | ||
return this._handle.serialize(type, offset); | ||
}; | ||
MurmurHash.prototype.copy = function(target) { | ||
MurmurHash.prototype.copy = function (target) { | ||
this._handle.copy(target && target._handle); | ||
@@ -123,7 +123,7 @@ return target; | ||
MurmurHash.prototype.toJSON = function() { | ||
MurmurHash.prototype.toJSON = function () { | ||
var handle = this._handle; | ||
return { | ||
type: handle.constructor.name, | ||
seed: handle.toJSON() | ||
seed: handle.toJSON(), | ||
}; | ||
@@ -133,30 +133,30 @@ }; | ||
Object.defineProperty(MurmurHash.prototype, "isBusy", { | ||
get: function() { | ||
get: function () { | ||
return this._handle.isBusy; | ||
}, | ||
enumerable: false, | ||
configurable: false | ||
configurable: false, | ||
}); | ||
Object.defineProperty(MurmurHash.prototype, "total", { | ||
get: function() { | ||
get: function () { | ||
return this._handle.total; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
configurable: true, | ||
}); | ||
Object.defineProperty(MurmurHash.prototype, "endianness", { | ||
get: function() { | ||
get: function () { | ||
return this._handle.endianness; | ||
}, | ||
set: function(value) { | ||
set: function (value) { | ||
this._handle.endianness = value; | ||
}, | ||
enumerable: true, | ||
configurable: false | ||
configurable: false, | ||
}); | ||
Object.defineProperty(MurmurHash.prototype, "SERIAL_BYTE_LENGTH", { | ||
get: function() { | ||
get: function () { | ||
Object.defineProperty(this, "SERIAL_BYTE_LENGTH", { | ||
@@ -166,3 +166,3 @@ enumerable: true, | ||
configurable: true, | ||
value: this._handle.SERIAL_BYTE_LENGTH | ||
value: this._handle.SERIAL_BYTE_LENGTH, | ||
}); | ||
@@ -172,3 +172,3 @@ return this.SERIAL_BYTE_LENGTH; | ||
enumerable: true, | ||
configurable: true | ||
configurable: true, | ||
}); |
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
538789
17
922
3
1
6
+ Addednan@^2.14.1
+ Addednan@2.22.0(transitive)