Class: Factory

Factory

new Factory(opts)

Parameters:
Name Type Description
opts Object Options for the factory

Members

<static> defaults :Object|function

The defaults property passed into the FactoryFactory for this Factory, used to set defaults on the options passed into this Factory.
Type:
  • Object | function

<static> factory :function

The factory property passed into the FactoryFactory for this Factory, if provided, this, instead of Object.create is used to create the instance, and Factory#props will be ignored.
Type:
  • function

<static> initialize :function

The initialize property passed into the FactoryFactory for this Factory, this function is called in the context of the created instance once it has been created.
Type:
  • function

<static> options :Object

The options passed into the FactoryFactory when it created this Factory.
Type:
  • Object

<static> props :Object|function

The props property passed into the FactoryFactory for this Factory, passed to Object.create as the second (props) argument.
Type:
  • Object | function

<static> validate :Object|function

The validate property passed into the FactoryFactory for this Factory, used to validate options passed into this Factory.
Type:
  • Object | function

Methods

<static> extend(extendOptions)

Creates a new Factory by extending this Factory, accepts the same arguments as the FactoryFactory.
Parameters:
Name Type Description
extendOptions Object Object to extend this Factory with.
Returns:
Factory
Example
const Factory = FactoryFactory();
const ExtendedFactory = Factory.extend();

const instance = ExtendedFactory();

instance instanceof Factory; // true
instance instanceof ExtendedFactory; // true
Rik Hoffbauer 2015
Documentation generated by JSDoc 3.4.0 on 2015-12-20T23:05:06+01:00