https://github.com/stagas/setter-decorator
decorator that attaches setters to class properties
https://github.com/stagas/setter-decorator
decorator property setter
Last synced: about 1 year ago
JSON representation
decorator that attaches setters to class properties
- Host: GitHub
- URL: https://github.com/stagas/setter-decorator
- Owner: stagas
- Created: 2021-12-04T14:03:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-01T19:16:25.000Z (over 4 years ago)
- Last Synced: 2025-03-11T20:51:18.984Z (over 1 year ago)
- Topics: decorator, property, setter
- Language: TypeScript
- Homepage:
- Size: 217 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
setter-decorator
decorator that attaches setters to properties
🔧 Install
· 🧩 Example
· 📜 API docs
· 🔥 Releases
· 💪🏼 Contribute
· 🖐️ Help
***
## Install
```sh
$ npm i setter-decorator
```
## API
#### Table of Contents
* [settable](#settable)
* [Parameters](#parameters)
* [setter](#setter)
* [Parameters](#parameters-1)
### settable
[src/index.ts:35-82](https://github.com/stagas/setter-decorator/blob/572b4c74029e822f2e0a8c79ca87b1bc97c016dd/src/index.ts#L35-L82 "Source code on GitHub")
Decorates a class as `@settable`. This is required for `@setter` to work.
```ts
```
#### Parameters
* `ctor` **any** The class to decorate
Returns **any** The decorated class
### setter
[src/index.ts:122-143](https://github.com/stagas/setter-decorator/blob/572b4c74029e822f2e0a8c79ca87b1bc97c016dd/src/index.ts#L122-L143 "Source code on GitHub")
Attaches a `@setter` to a property.
```ts
```
#### Parameters
* `fn` **Setter** The setter function
Returns **PropertyDecorator** A property decorator
## Contribute
[Fork](https://github.com/stagas/setter-decorator/fork) or
[edit](https://github.dev/stagas/setter-decorator) and submit a PR.
All contributions are welcome!
## License
MIT © 2021
[stagas](https://github.com/stagas)