Giter Club home page Giter Club logo

wryk-properties's Introduction

This repository is a mirror of the component module wryk/properties. It has been modified to work with NPM+Browserify. You can install it using the command npm install npmcomponent/wryk-properties. Please do not open issues or send pull requests against this repo. If you have issues with this repo, report it to npmcomponent.

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

wryk-properties's People

Contributors

airportyh avatar vendethiel avatar wryk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.