Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tmyt/node-dynamic
implement dynamic property object from javascript
https://github.com/tmyt/node-dynamic
Last synced: about 2 months ago
JSON representation
implement dynamic property object from javascript
- Host: GitHub
- URL: https://github.com/tmyt/node-dynamic
- Owner: tmyt
- Created: 2015-09-29T07:47:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-18T07:33:09.000Z (almost 9 years ago)
- Last Synced: 2024-10-12T14:12:34.498Z (3 months ago)
- Language: C++
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
node-dynamic
===- master: [![Build Status](https://travis-ci.org/tmyt/node-dynamic.svg?branch=master)](https://travis-ci.org/tmyt/node-dynamic)
## overview
This library enables to declare property getter and setter by JavaScript.
## example
### declare getter by property
```javascript
var Dynamic = require('dynamic');
var d = new Dynamic();
d.get = function(n){ return 10; }
// expect: d.prop = 10
console.log("d.prop = " + d.prop);
// actual: d.prop = 10
```### declare getter by base object
```javascript
var Dynamic = require('dynamic');
var d = new Dynamic({
get: function(n){ return 10; }
});
// expect: d.prop = 10
console.log("d.prop = " + d.prop);
// actual: d.prop = 10
```## constructor
### new Dynamic()
create new dynamic object instance.
### new Dyamic(object)
create new dynamic object baseed on 'object'.
## special members
these members reserved for internaly use.
- get
- set
- enumerate
- query
- delete## handlers
### get(name)
return value for 'name'.
### set(name, value)
set value for 'name', and return setted 'value'.
### enumerate()
return array for property names for current object.
### query(name)
return property attribute for 'name'.
### delete(name)
delete property 'name'.