You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@leapfrogtechnology/async-store

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leapfrogtechnology/async-store - npm Package Compare versions

Comparing version

to
1.0.1

8

CHANGELOG.md
# Change Log
## [1.0.1](https://github.com/leapfrogtechnology/async-store/tree/1.0.1) (2019-07-19)
[Full Changelog](https://github.com/leapfrogtechnology/async-store/compare/1.0.0...1.0.1)
**Changes**
- Update example to use correct store [\#11](https://github.com/leapfrogtechnology/async-store/pull/11) ([mesaugat](https://github.com/mesaugat))
- Add GitHub URL and update description in package.json [\#10](https://github.com/leapfrogtechnology/async-store/pull/10) [[documentation](https://github.com/leapfrogtechnology/async-store/labels/documentation)] ([mesaugat](https://github.com/mesaugat))
## [1.0.0](https://github.com/leapfrogtechnology/async-store/tree/1.0.0) (2019-07-19)

@@ -4,0 +12,0 @@ [Full Changelog](https://github.com/leapfrogtechnology/async-store/compare/1.0.0-beta.1...1.0.0)

11

package.json
{
"name": "@leapfrogtechnology/async-store",
"version": "1.0.0",
"description": "Async Store",
"version": "1.0.1",
"description": "Global store utility for an async operation lifecycle and chain of callbacks",
"license": "MIT",

@@ -11,2 +11,9 @@ "main": "dist/index.js",

],
"repository": {
"type": "git",
"url": "https://github.com/leapfrogtechnology/async-store"
},
"bugs": {
"url": "https://github.com/leapfrogtechnology/async-store/issues"
},
"scripts": {

@@ -13,0 +20,0 @@ "lint": "tslint -c tslint.json 'src/**/*.{ts,js}' 'test/**/*.{ts,js}'",

39

README.md

@@ -6,7 +6,7 @@ # Async Store

[![LICENSE](https://img.shields.io/github/license/leapfrogtechnology/async-store.svg?style=flat-square)](https://github.com/leapfrogtechnology/async-store/blob/master/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/leapfrogtechnology/async-store)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/leapfrogtechnology/async-store#contributing)
Global store utility for an async operation lifecycle and chain of callbacks. It is a utility tool similar to [continuation-local-storage](https://github.com/othiym23/node-continuation-local-storage) which allows us to set and get values that are scoped to the lifetime of these chains of callbacks.
**Note: async-store uses [domain](https://nodejs.org/api/domain.html) Node.js module under the hood.**
**Note: async-store uses [domain](https://nodejs.org/api/domain.html) Node.js module under the hood.**

@@ -27,3 +27,3 @@ It is recommended that you read about domain before using this package.

### Simple JavaScript Example
### JavaScript Example

@@ -38,13 +38,13 @@ ```js

.then(() => {
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
})
.then(() => {
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
})
.then(() => {
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
})
.then(() => {
// Store value is available at the end of the promise chain.
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
});

@@ -56,3 +56,3 @@ }

### Simple TypeScript Example
### TypeScript Example

@@ -67,10 +67,10 @@ ```js

.then(() => {
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
})
.then(() => {
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
})
.then(() => {
// Store value is available at the end of the promise chain.
console.log('Value of foo: ', globalStore.get('foo'));
console.log('Value of foo: ', store.get('foo'));
});

@@ -112,2 +112,3 @@ }

## Sample Projects
1. [Simple Express Sample (TypeScript)](examples/express-ts)

@@ -121,3 +122,3 @@

- `@param {AsyncStoreAdapter} [adapter=AsyncStoreAdapter.DOMAIN]`: Store adaptor (Default: domain).
- `@param {AsyncStoreAdapter} [adapter=AsyncStoreAdapter.DOMAIN]`: Store adapter.
- `@returns {(req, res, next) => void}`

@@ -140,4 +141,2 @@

**Example**
```js

@@ -151,7 +150,7 @@ store.set({ foo: 'Hello', bar: 'World' });

- `@params {string} key` - Key specifies property of store.
- `@params {string} key`: Key specifies property of store.
- `@returns {any}`
```js
store.get('foo');
const foo = store.get('foo');
```

@@ -163,7 +162,7 @@

- `@params {string} key` - Key specifies property of store.
- `@params {string} key`: Key specifies property of store.
- `@returns {any}`
```js
store.find('foo');
const foo = store.find('foo');
```

@@ -175,4 +174,8 @@

## Contributing
Feel free to send pull requests.
## License
Licensed under [The MIT License](LICENSE).