0.1.23 • Published 8 months ago
conode v0.1.23
CoNode
0-Deps, simple and fast context library for NodeJS
Table of Contents
Features
- Provides useful wrappers of AsyncLocalStorage
- Supports TypeScript typings
- Supports CommonJS and ES Module systems
Installing
Using yarn:
yarn add conode
Using npm:
yarn add conode
Examples
Functional approach
import { createContext } from '../index';
const auth = createContext();
const action = () => {
const jwt = auth.getContext();
console.log(jwt);
};
auth.contextualize(jwt, action);
Class approach
import { contextualize, Context } from '../index';
const action = () => {
const service = Service.getContext();
console.log(service.getSomething());
};
class Service extends Context() {
@contextualize
async run() {
await action();
}
getSomething() {
return 'something';
}
}
const service = new Service();
service.run();
License
License Apache-2.0 Copyright (c) 2022-present Ivan Zakharchanka
0.1.22
10 months ago
0.1.23
8 months ago
0.1.21
10 months ago
0.1.20
12 months ago
0.1.19
1 year ago
0.1.12
1 year ago
0.1.13
1 year ago
0.1.14
1 year ago
0.1.15
1 year ago
0.1.16
1 year ago
0.1.17
1 year ago
0.1.18
1 year ago
0.1.10
1 year ago
0.1.11
1 year ago
0.1.8
1 year ago
0.1.7
1 year ago
0.1.9
1 year ago
0.1.4
1 year ago
0.1.3
1 year ago
0.1.6
1 year ago
0.1.5
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago
0.0.1
1 year ago