Skip to content

krambuhl/mutators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mutators

Mixin for get/set object mutator behavior

Useage

var extend = require('extend');
var Mutators = require('mutators');

// creates object with get/set functions
var person = extend({}, Mutators);

// set an object attribute
person.set('name', 'bill');

// get an object attribute
log(person.get('name'))

Methods

Methods are defined with the expectation that they will be extended into an instance or prototype of an object. They won't work as static functions.

get(property)

Returns the value of object property.

person.get('name')

set(property, value)

Defines a key-value pair on context object. Multiple key-value pairs can be defined by passing an object.

person.set('name', 'bill');

About

mixin for get/set object behavior

Resources

License

Stars

Watchers

Forks

Packages

No packages published