setter-method

0.1.0 • Public • Published

setter-method

getter setter methods without the boilerplate

Installation

With packin or component

$ packin add jkroso/setter-method

then in your app:

var addSetter = require('setter-method')

API

addSetter(object, property, default)

create a chainable getter/setter method on obj

var object = {};
 
// create methods and default values
addSetter(object, 'width', 50);
addSetter(object, 'height', 100);
addSetter(object, 'color', 'aliceblue');
 
// set values
object
  .width(1200)
  .height(800);
 
// get values
object.width(); // => 1200
object.color(); // => 'aliceblue'

Running the tests

Just run make and navigate your browser to the test directory.

Readme

Keywords

none

Package Sidebar

Install

npm i setter-method

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • jkroso