New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cef

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cef - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

26

lib/cef.js

@@ -361,3 +361,29 @@ /**

/**
* getInstance: get a singleton instance of the logger for a given config
*
* @param config
* (object) The logger config (see Logger constructor)
*
*/
var instances = {};
var getInstance = function getInstance(config) {
config = config || {};
// make an instance key for this config
var configKey = [];
Object.keys(config).sort().forEach(function(key) {
configKey.push(key + '=' + config[key]);
});
// stringify the array
configKey = configKey.join(',');
if (!instances[configKey]) {
instances[configKey] = new Logger(config);
}
return instances[configKey];
};
module.exports.getInstance = getInstance;
/*

@@ -364,0 +390,0 @@ * CEF Helpers

2

package.json
{
"name": "cef",
"version": "0.3.0",
"version": "0.3.1",
"main" : "lib/cef.js",

@@ -5,0 +5,0 @@ "author": "Jed Parsons <https://github.com/jedp>",

@@ -35,3 +35,4 @@ # node-cef: A CEF and Syslog Logging Library

var logger = new cef.Logger(config);
// Get a singleton instance for this config
var logger = cef.getInstance(config);

@@ -38,0 +39,0 @@ logger.info({signature: "Bflat", name: "Out of tune"});

@@ -84,4 +84,25 @@ var vows = require('vows');

}
}).
addBatch({
"getInstance": {
topic: function() {
var config = {
vendor: 'Foo',
product: 'Bar',
version: '0.1-baz'
};
return [config, cef.getInstance(config)];
},
"returns a singleton": function(tuple) {
var config = tuple[0];
var firstLogger = tuple[1];
assert(cef.getInstance(config) === firstLogger);
assert(cef.getInstance() !== firstLogger);
}
}
});
if (process.argv[1] === __filename) {

@@ -88,0 +109,0 @@ suite.run();

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