1.0.5 • Published 2 years ago

tyinstance v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

tyInstance

tyInstance is a instance creator helper in typescript.

Installing

npm install tyinstance

Documentation

Here how to use the package:

Example 1

class ClassToCreate {
  constructor(public value: number, public name?: string) {}
}

class SomeClass {
  constructor() {
    let classToCreate = Instance.create(ClassToCreate, 100, 'Name');
  }
}

class SomeOtherClass {
  constructor() {
    let classToCreate = Instance.create(ClassToCreate, 10);
  }
}

Example 2

@Type({ name: 'SomeClassToCreate' })
class ClassToCreate {
  constructor(public value?: number) {}
}

class SomeClass {
  constructor() {
    let classToCreate = Instance.create('SomeClassToCreate', 100);
  }
}
class SomeOtherClass {
  constructor() {
    let classToCreate = Instance.create('SomeClassToCreate');
  }
}

Example 3

@Type() // If propery name doesn't pass, then the name of class would be the actual name of class , 'ClassToCreate'
class ClassToCreate {
  constructor(public value?: number) {}
}

class SomeClass {
  constructor() {
    let classToCreate = Instance.create('ClassToCreate', 100);
  }
}
class SomeOtherClass {
  constructor() {
    let classToCreate = Instance.create('ClassToCreate');
  }
}

Running Tests

To run tests, run the following command

  npm run test

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago