Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

properties

defines new or modifies properties on an object with data/accessor descriptor

Installation

$ component install wryk/properties

Usage

//use properties for es6 Object.is and Object.mixin monkey-patch
var properties = require('properties');

var is = function (a, b) {
  //code for es6 Object.is shim
};

var mixin = function (target, source) {
  //code for es6 Object.mixin shim
};


properties(Object)
  //use sugar form for is
  .property('is')
    .configurable()
    .writable()
    .enumerable(false)
    .value(is)
    .define()

  //use basic form for mixin
  .property('mixin', {
    configurable: true,
    writable: true,
    enumerable: false,
    value: mixin
  })
;



//or you can use default method
properties(Object)
  //default descriptor
  .default({ writable: true, configurable: true, enumerable: false })

  //sugar form
  .property('is')
    .value(is)
    .define()

  //basic form
  .property('mixin', {
    value: mixin
  })
;

API

properties(object)

properties(object).default(descriptor)

properties(object).property(property)

properties(object).property(property).configurable([value = true])

properties(object).property(property).writable([value = true])

properties(object).property(property).enumerable([value = true])

properties(object).property(property).getter(value)

properties(object).property(property).setter(value)

properties(object).property(property).value(value)

properties(object).property(property).define()

Running tests

First, make sure dependencies are installed:

$ npm install

and run test:

$ make test

License

MIT

About

defines new or modifies existing properties on an object with descriptor and configured descriptor property

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages