{"dist":{"shasum":"03e52ecaea65a745fca728839eb2475442261205","tarball":"https://registry.npmjs.org/pd/-/pd-0.6.2.tgz","integrity":"sha512-h3buIhXm69Jmp0iTyyBeG/ImWNcDdaTfmkH1WQtHJtqyq6ZbRIqDhPvSt/6bcIQ4CiKAkLBfANbm7yLpbxV6ag==","signatures":[{"sig":"MEYCIQC37Ged8dkCNjq+03BWET+Mmty3cMFE0mXzTCwkVfzdFAIhALKXbXo9wYU3t+i0Zorvvv1DAz471JTCh3vO+mS4gX3/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/pd","name":"pd","author":{"name":"Jake Verbaten","email":"raynos2@gmail.com"},"readme":"# pd [![Build Status][1]][2]\r\n\r\nHelping you do prototypical OO\r\n\r\n## Status: production ready\r\n\r\n## Example \r\n\r\n    var Animal = {\r\n        legs: 4,\r\n        walk: function () { ... }\r\n    };\r\n\r\n    var Cat = pd.extend(Object.create(Animal), {\r\n        nyan: function () { ... },\r\n        constructor: function () { this.lives = 9; return this; }\r\n    });\r\n\r\n    var cat = Object.create(Cat).constructor();\r\n\r\n## Motivation\r\n\r\nES5 OO is [verbose][8]\r\n\r\npd solves this with utilities and sugar.\r\n\r\n## Blog Posts\r\n\r\n - [Improving ES5 OO][9]\r\n - [Doing OO JS part 3][6]\r\n - [Doing OO JS part 2][5]\r\n - [Doing Object Oriented JavaScript][3]\r\n\r\n## Documentation\r\n\r\n### <a name=\"pd\" href=\"#pd\">pd (obj)</a>\r\n\r\npd converts all the values of your objects properties into property descriptors of those values.\r\n\r\n    pd({\r\n        \"foo\": \"bar\"\r\n    })\r\n\r\nis the same as\r\n\r\n    {\r\n        \"foo\": {\r\n            \"value\": \"bar\",\r\n            \"enumerable\": true,\r\n            \"writable\": true,\r\n            \"configurable\": true\r\n        }\r\n    }\r\n\r\n### <a name=\"pd.extend\" href=\"#pd.extend\">pd.extend (obj..)</a>\r\n\r\npd.extend extends an object with other objects. key clashes are given right preference\r\n\r\n    pd.extend(\r\n        {\r\n            \"one\": \"faz\",\r\n            \"three\": \"bar\"\r\n        },\r\n        {\r\n            \"two\": \"ni\",\r\n            \"three\": \"baz\"\r\n        },\r\n        {\r\n            \"three\": \"bas\",\r\n            \"four\": \"four\"\r\n        }\r\n    );\r\n\r\nis the same as\r\n\r\n    {\r\n        \"one\": \"faz\",\r\n        \"two\": \"ni\",\r\n        \"three\": \"bas\",\r\n        \"four\": \"four\"\r\n    }\r\n    \r\npd.extend returns the first object you pass in.\r\n\r\n### <a name=\"pd.bindAll\" href=\"#pd.bindAll\">pd.bindAll (obj..)</a>\r\n\r\npd.bindAll is similar to underscore's bindAll method. It takes an object and binds all it's methods to the object. It takes an optional list of objects to mix in\r\n\r\n    var o = {\r\n        constructor() { \r\n            pd.bindAll(this, {\r\n                draw: function () { \r\n                    /* use `this` with its \"correct\" value, i.e. `o` */\r\n                }\r\n            });\r\n        },\r\n        start: function (eventEmitter) {\r\n            // note `this.draw` would not work correctly if it wasn't bound\r\n            eventEmitter.on(\"draw\", this.draw);\r\n        }\r\n    };\r\n\r\n### <a name=\"pd.Name\" href=\"#pdName\">pd.Name</a>\r\n\r\npd.Name constructs a Name function. This name function when passed your object will\r\nreturn a privates object. This privates object cannot be accessed in any other \r\nway then calling Name.\r\n\r\nExample:\r\n\r\n    var Klass = (function () {\r\n        var privates = pd.Name();\r\n\r\n        return {\r\n            constructor: function (secret) {\r\n                privates(this).secret = secret;\r\n            },\r\n            getSecret: function () {\r\n                return privates(this).secret;\r\n            }\r\n        };\r\n    }());\r\n\r\n## Installation\r\n\r\n`npm install pd`\r\n\r\n## Test\r\n\r\n`make test`\r\n\r\n## Contributors\r\n\r\n - Raynos\r\n - Gozala\r\n\r\n## MIT Licenced\r\n\r\n  [1]: https://secure.travis-ci.org/Raynos/pd.png\r\n  [2]: http://travis-ci.org/Raynos/pd\r\n  [3]: http://raynos.org/blog/4/Doing-Object-Oriented-JavaScript\r\n  [4]: http://www.2ality.com/2011/06/prototypes-as-classes.html\r\n  [5]: http://raynos.org/blog/5/Doing-Object-Oriented-Javascript---part-2\r\n  [6]: http://raynos.org/blog/7/Doing-Object-Oriented-Javascript---part-3\r\n  [8]: https://gist.github.com/1384024\r\n  [9]: http://raynos.org/blog/17/Improving-ES5-OO-with-pd","engines":{"node":"0.6.x"},"scripts":{"test":"make test"},"_npmUser":{"name":"raynos","email":"raynos2@gmail.com"},"keywords":["oo","oop","propertydescriptor","arch","utility"],"repository":{"url":"git://github.com/Raynos/pd.git","type":"git"},"_npmVersion":"1.1.0","description":"Manage propertyDescriptors, an OO utility","directories":{},"maintainers":[{"name":"raynos","email":"raynos2@gmail.com"}],"_nodeVersion":"v0.6.6","dependencies":{},"_defaultsLoaded":true,"devDependencies":{"mocha":"0.8.1"},"_engineSupported":true,"optionalDependencies":{},"_id":"pd@0.6.2","version":"0.6.2"}