@leapfrogtechnology/async-store
Advanced tools
Comparing version
# 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) |
{ | ||
"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}'", |
@@ -6,7 +6,7 @@ # Async Store | ||
[](https://github.com/leapfrogtechnology/async-store/blob/master/LICENSE) | ||
[](https://github.com/leapfrogtechnology/async-store) | ||
[](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). |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
33712
2.58%1
-50%171
1.79%0
-100%0
-100%