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

conode

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conode

0-Deps, simple and fast context library for NodeJS

  • 0.1.23
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CoNode

0-Deps, simple and fast context library for NodeJS

Build Status NPM version Downloads Coverage Status Maintainability Snyk

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

Keywords

FAQs

Package last updated on 31 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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