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