Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

vectorsize/get-set

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AddgetterSetter

A simple library for the lazy developper

Adds getter/setters to a given object, the type of getter and setters added will be of jquery/d3 type:

var getSet = require('getSet');

var obj = {};

var addAcc = getSet(obj);
  addAcc('with');
  addAcc('height');
// or addAcc(['with', 'height'])  

obj.width(300);
obj.with(); // => 300

API

The main exported function takes the object to augment, that will then return a function to add the specified accessors to the object.

The lib will create non enumerable "private" underscored versions of your property, and the corresponding public getter/setter method.

Using

You can use the provided getSet.min.js or browserify your own with grunt. In order to use grunt, from the root of the module just do

npm install && grunt

This will install the dependencies and re-compile browserified and minified versions of the lib. To run the tests just navigate to the tests subdirectory and run the index.html file.

About

Adds getters and setters à la d3/jquery to a given object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published