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 thisFactory
, used to set defaults on the options passed into thisFactory
.Type:
- Object | function
-
<static> factory :function
-
The factory property passed into the
FactoryFactory
for thisFactory
, 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 thisFactory
, 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 thisFactory
.Type:
- Object
-
<static> props :Object|function
-
The props property passed into the
FactoryFactory
for thisFactory
, passed to Object.create as the second (props) argument.Type:
- Object | function
-
<static> validate :Object|function
-
The validate property passed into the
FactoryFactory
for thisFactory
, used to validate options passed into thisFactory
.Type:
- Object | function
Methods
-
<static> extend(extendOptions)
-
Parameters:
Name Type Description extendOptions
Object Object to extend this Factory
with.Returns:
FactoryExample
const Factory = FactoryFactory(); const ExtendedFactory = Factory.extend(); const instance = ExtendedFactory(); instance instanceof Factory; // true instance instanceof ExtendedFactory; // true