z-container

1.0.1 • Public • Published

z-container

Build Status npm version

This is a container solution to save and later retrieve object references, and other data.

Since it's a CommonJS module, it must be used alongside with Browserify, or something similar, like WebPacker.

Example, explanation

var container = require('z-container');

container.add('some_object_reference', object_reference);

container.has('some_object_reference');
// -> true, only if the key really exists in the container

// Returns the previously saved reference.
// This is useful, when CommonJS modules compiled to the web need to access a
// certain module which was instantiated by the `new` operator.
container.get('some_object_reference');

// The container can save and retrieve other kinds of data too, which is useful
// when you have to pass data at runtime, and cannot simply `require()` data
// from a file.
container.add('some_string', 'string');
container.get('some_string'); // returns "string"

License

MIT

Dependents (0)

Package Sidebar

Install

npm i z-container

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • zeecoder