rw_ize

1.0.0 • Public • Published

rw_ize

Add readable and writable properties to your "classes" and objects.

Install and Use It

In your shell:

npm install rw_ize

In your coffeescript:

rw = require "rw_ize"

class Pancake

   rw.ize(this)
   @read_able       "size"
   @write_able      "location"
   @read_write_able "name"
   @read_write_able_bool "for_sale"

   constructor(name):
     @write "size", "3.5 inches"
     @write "name", name

cake = new Pancake("Bob")
cake.size()  # --> "3.5 inches"
cake.location "NYC"
cake.name()  "Billy Bob"
cake.for_sale()  # --> false
cake.for_sale(true)
cake.for_sale() # --> true

You can also use it directly on objects:

car = {}
rw.ize(car)
car.read_write_able "price"
car.price   "$3,000"
car.price()  # ---> "$3,000"

/rw_ize/

    Package Sidebar

    Install

    npm i rw_ize

    Weekly Downloads

    6

    Version

    1.0.0

    License

    BSD

    Last publish

    Collaborators

    • da99