1# prr [![Build Status](https://secure.travis-ci.org/rvagg/prr.png)](http://travis-ci.org/rvagg/prr) 2 3An sensible alternative to `Object.defineProperty()`. Available in npm and Ender as **prr**. 4 5## Usage 6 7Set the property `'foo'` (`obj.foo`) to have the value `'bar'` with default options (`'enumerable'`, `'configurable'` and `'writable'` are all `false`): 8 9```js 10prr(obj, 'foo', 'bar') 11``` 12 13Adjust the default options: 14 15```js 16prr(obj, 'foo', 'bar', { enumerable: true, writable: true }) 17``` 18 19Do the same operation for multiple properties: 20 21```js 22prr(obj, { one: 'one', two: 'two' }) 23// or with options: 24prr(obj, { one: 'one', two: 'two' }, { enumerable: true, writable: true }) 25``` 26 27### Simplify! 28 29But obviously, having to write out the full options object makes it nearly as bad as the original `Object.defineProperty()` so we can simplify. 30 31As an alternative method we can use an options string where each character represents a option: `'e'=='enumerable'`, `'c'=='configurable'` and `'w'=='writable'`: 32 33```js 34prr(obj, 'foo', 'bar', 'ew') // enumerable and writable but not configurable 35// muliple properties: 36prr(obj, { one: 'one', two: 'two' }, 'ewc') // configurable too 37``` 38 39## Where can I use it? 40 41Anywhere! For pre-ES5 environments *prr* will simply fall-back to an `object[property] = value` so you can get close to what you want. 42 43*prr* is Ender-compatible so you can include it in your Ender build and `$.prr(...)` or `var prr = require('prr'); prr(...)`. 44 45## Licence 46 47prr is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. 48