@nfactorial/factory_node

0.0.3 • Public • Published

Build status

Linux
lin-badge

Factory

Simple module for Node.js that provides a class for creating objects by name.

This module is available using npm, to install into your own project run:

npm install --save @nfactorial/factory_node

Once installed, require it as any other module with, then create a factory with the new operator:

const Factory = require('@nfactorial/factory_node');

const myFactory = new Factory();

To use the factory, you must register your objects with your created factory instance.

const Factory = require('@nfactorial/factory_node');

const myFactory = new Factory();

myFactory.register('object_name', MyClass);

const classInstance = myFactory.create('object_name');

Readme

Keywords

none

Package Sidebar

Install

npm i @nfactorial/factory_node

Weekly Downloads

1

Version

0.0.3

License

ISC

Last publish

Collaborators

  • nfactorial