Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sticky-module

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sticky-module

A Symbol based leaky utility to store or retrieve a module

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1K
decreased by-15.58%
Maintainers
1
Weekly downloads
 
Created
Source

sticky-module

build status Coverage Status

A Symbol based leaky utility to store or retrieve a module, so that libraries can actually be sure if these are re-bundled elsewhere they still work as expected or do not bootstrap twice.

import stickyModule from 'sticky-module';

let [{a, b}, known] = stickyModule('@custom/name', {
  a: Math.random(),
  b: 'let it'
});

known;    // `false`
({a, b}); // the random value and the string "let it"

// on a further attempt it will return exact same object
// hence exact same random value `a` had before
[{a, b}, known] = stickyModule('@custom/name', {
  a: Math.random(),
  b: 'nope, already there'
});

known;    // this time it's `true`
({a, b}); // the same previous random value and the same string "let it"

Keywords

FAQs

Package last updated on 04 Nov 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