https://github.com/invrs/industry-instance
Defines a factory function that builds instances
https://github.com/invrs/industry-instance
Last synced: about 2 months ago
JSON representation
Defines a factory function that builds instances
- Host: GitHub
- URL: https://github.com/invrs/industry-instance
- Owner: invrs
- Created: 2016-02-18T19:52:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-11T06:53:32.000Z (about 10 years ago)
- Last Synced: 2025-08-15T05:33:52.327Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IndustryInstance [](https://travis-ci.org/invrs/industry-instance)
Defines a factory function that builds instances.
## Usage
```js
import { factory } from "industry"
import { instance } from "industry-instance"
class Test {
constructor() {
this.rand = Math.random()
}
}
let test = factory(Test)
.set("instance", instance)
test().rand == test().rand // true
test("key").rand == test("key").rand // true
test("key").rand == test().rand // false
```