https://github.com/rmw-lib/at.property
https://github.com/rmw-lib/at.property
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rmw-lib/at.property
- Owner: rmw-lib
- License: other
- Created: 2020-08-15T14:46:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-16T02:51:57.000Z (almost 6 years ago)
- Last Synced: 2025-09-17T06:05:00.815Z (10 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Object.defineProperty for coffeescript
install
```
npm install at.property
```
use
```
require 'at.property'
class Person
constructor: (@firstName, @lastName) ->
@property(
name:
get: -> "#{@firstName} #{@lastName}"
set: (name) -> [@firstName, @lastName] = name.split ' '
)
```
code
```
Function::property = (dict) ->
for attr of dict
Object.defineProperty @::, attr, dict[attr]
```