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

1t

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

1t

Ensures that only one instance of your module exists either serverside or in the browser.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

1t build status

Ensures that only one instance of your module exists either serverside or in the browser.

1t == one ton == a singleton

var singleton = require('1t');

// #ifndef
singleton('__FOO__', module, function () {
// #define __FOO__

var path = require('path');

exports.hello = 'world';  
exports.filename = path.basename(__filename);

})
// #endif

Installation

npm install 1t

API

singleton(id, mdl, fn)

Ensures that only one instance for the wrapped module is instantiated. Works similar to #ifndef/#define pragmas in C

Parameters:
NameTypeDescription
id string

the unique id under which the module is stored in the global namespace

mdl Object

the module variable that is passed to each node/browserify module

fn function

function that wraps the code of the module

Source:

generated with docme

License

MIT

Keywords

FAQs

Package last updated on 18 Apr 2014

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