https://github.com/duart38/accessors
Accessor decoration made easier
https://github.com/duart38/accessors
accessor decorators deno javascript typescript
Last synced: about 2 months ago
JSON representation
Accessor decoration made easier
- Host: GitHub
- URL: https://github.com/duart38/accessors
- Owner: duart38
- License: apache-2.0
- Created: 2021-04-22T08:26:57.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T17:02:42.000Z (over 3 years ago)
- Last Synced: 2024-05-01T23:18:45.541Z (about 2 years ago)
- Topics: accessor, decorators, deno, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# How it works
```typescript
import { decorateAccessors } from "./mod.ts";
const myObj = {
name: "John",
age: 34,
};
const p = decorateAccessors(myObj, (v) => {
console.log(v); // new value
// do something when setter is called
});
// now you can just assign values and have the call-back triggered
p.age = 9999;
```