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

nesting-doll

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nesting-doll - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.travis.yml

10

package.json
{
"name": "nesting-doll",
"version": "1.0.1",
"version": "1.0.2",
"description": "Nested context library using CLS",

@@ -11,12 +11,12 @@ "main": "index.js",

"type": "git",
"url": "https://github.com/sneekers/nested-doll.git"
"url": "https://github.com/sneekers/nesting-doll.git"
},
"bugs": {
"url": "https://github.com/sneekers/nested-doll/issues"
"url": "https://github.com/sneekers/nesting-doll/issues"
},
"homepage": "https://github.com/sneekers/nested-doll",
"homepage": "https://github.com/sneekers/nesting-doll",
"author": "Jacob Chapel <jacob.chapel@gmail.com>",
"license": "MIT",
"dependencies": {
"continuation-local-storage": "^3.1.0",
"continuation-local-storage": "^3.1.1",
"hoek": "^2.4.1"

@@ -23,0 +23,0 @@ },

@@ -1,11 +0,11 @@

# Nesting Doll
# Nesting Doll [![travis](https://img.shields.io/travis/sneekers/nesting-doll.svg)](https://travis-ci.org/sneekers/nesting-doll) [![npm](https://img.shields.io/npm/v/nesting-doll.svg)](https://npmjs.org/package/nesting-doll)
This library is a simple component for building nested contexts/scopes
(leveraging [continuation-local-storage](https://github.com/othiym23/node-continuation-local-storage))
which can be used for things such as a transaction logger. In fact, I build this expressly to be the
which can be used for things such as a transaction logger. In fact, I built this expressly as the
foundation for a nested transaction logger.
It exposes [dolls](https://github.com/sneekers/nested-doll/#new-dollname-namespace-state) which are containers
for the current level context. Each **doll** has its own "state" which is specific to that container.
Each nested doll you create, it tracks the outer most doll and the previous doll, which can be used to track
It exposes [dolls](https://github.com/sneekers/nesting-doll/#new-dollname-namespace-state) which are containers
for the current level context. Each **doll** maintains a "state" specific to that container.
Each nested doll created tracks the outer most doll and the previous doll, allowing access to
the top transaction and the previous transaction as you go down.

@@ -30,3 +30,3 @@

### nestingDoll.nest(name, [state])
Creates new doll with given name and prepopulated with the data given as the dolls state.
Creates new doll with given name and pre-populated with the data given as the dolls state.
```js

@@ -80,3 +80,3 @@ var doll = nestingDoll.nest('foo', {timestamp: Date.now()});

### doll.run(function)
Run is an easy way to directly create a new doll context which any function inside of will have access to.
Run is an easy way to directly create a new doll context. Any function inside will have access to it.
```js

@@ -92,3 +92,3 @@ var doll = nestingDoll.nest('foo');

### doll.bind(function, [context])
Bind allows you to wrap a function so when it is called, the context is created automatically.
Bind allows you to wrap a function that automatically creates a context when called.
You can optionally pass in a CLS namespace context, which attaches the doll to that context.

@@ -105,5 +105,4 @@ ```js

### doll.rawBind(function, [context])
Raw bind is meant to bind a function similarly to doll.bind() above, but does not run the
doll nesting functionality (which sets outer and previous dolls). This was created specifically
to assist in binding multiple functions to the same doll context without running the nesting
Raw bind is similar to `doll.bind()` above but does not run the
doll nesting functionality (which sets outer and previous dolls). This allows binding multiple functions to the same doll context without running the nesting
code more than once.

@@ -174,10 +173,9 @@ ```js

### doll.previous() or doll.outer()
Returns the previous or outer most doll based on this current doll.
Returns the previous or outer most doll relative to this current doll.
See examples above for usage.
### doll.activate() or doll.deactivate()
This activates or deactivates a doll. Dolls are not activated by default, which means
until you activate the doll, you won't be able to nest any other dolls inside of it.
This activates or deactivates a doll. Dolls are not active by default. Until you activate the doll you won't be able to nest any other dolls inside of it.
This is useful for explicitly ending a doll based transaction, so subsequent dolls
This is useful for explicitly ending a doll-based transaction, so subsequent dolls
that aren't nested but called in the same scope do not polute your nested scope.

@@ -184,0 +182,0 @@

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