https://github.com/afeiship/next-instance
Create an instance without new.
https://github.com/afeiship/next-instance
alloc create instance new next
Last synced: 9 months ago
JSON representation
Create an instance without new.
- Host: GitHub
- URL: https://github.com/afeiship/next-instance
- Owner: afeiship
- License: mit
- Created: 2020-06-29T06:25:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-21T00:26:41.000Z (about 5 years ago)
- Last Synced: 2025-03-17T22:55:54.517Z (9 months ago)
- Topics: alloc, create, instance, new, next
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-instance
> Create an instance without new.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```bash
npm install -S @jswork/next-instance
```
## usage
```js
import '@jswork/next-instance';
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
const p1 = nx.instance(Person, 'fei', 100);
// Person { name: 'fei', age: 100 }
```
## license
Code released under [the MIT license](https://github.com/afeiship/next-instance/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/next-instance
[version-url]: https://npmjs.org/package/@jswork/next-instance
[license-image]: https://img.shields.io/npm/l/@jswork/next-instance
[license-url]: https://github.com/afeiship/next-instance/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-instance
[size-url]: https://github.com/afeiship/next-instance/blob/master/dist/next-instance.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/next-instance
[download-url]: https://www.npmjs.com/package/@jswork/next-instance