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

continuation-local-storage

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

continuation-local-storage - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

test/async-context.tap.js

21

context.js

@@ -5,2 +5,5 @@ 'use strict';

// load polyfill if native support is unavailable
if (!process.addAsyncListener) require('async-listener');
var namespaces = process.namespaces = Object.create(null);

@@ -88,4 +91,20 @@

module.exports = {
createNamespace : function (name) { return new Namespace(name); },
createNamespace : function (name) {
var namespace = new Namespace(name);
process.addAsyncListener(
function () {
return namespace.active;
},
{
before: function (context) {
namespace.enter(context);
},
after: function (context) {
namespace.exit(context);
}
}
);
return namespace;
},
getNamespace : getNamespace
};

5

package.json
{
"name": "continuation-local-storage",
"version": "1.1.1",
"version": "2.0.0",
"description": "userland implementation of https://github.com/joyent/node/issues/5243",

@@ -32,3 +32,6 @@ "main": "context.js",

"tap": "~0.4.2"
},
"optionalDependencies": {
"async-listener": "0.0.2"
}
}

@@ -9,3 +9,3 @@ 'use strict';

// module under test
var context = require('../context');
var context = require('../context.js');

@@ -12,0 +12,0 @@ // multiple contexts in use

@@ -51,6 +51,4 @@ 'use strict';

process.nextTick(function () {
// FIXME: once this is in core, 'value' should be 1 because
// outer is still active
// FIXME: t.equal(writer.active, outer, "writer.active == outer");
t.equal(writer.get('value'), 0, "inner hasn't been entered yet");
t.equal(writer.active, outer, "writer.active == outer");
t.equal(writer.get('value'), 1, "inner has been entered");
writer.run(function (inner) {

@@ -57,0 +55,0 @@ t.equal(writer.active, inner, "writer.active == inner");

@@ -9,3 +9,3 @@ 'use strict';

// module under test
var context = require('../context');
var context = require('../context.js');

@@ -12,0 +12,0 @@ // multiple contexts in use

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