{"_id":"facet","_rev":"234776","name":"facet","description":"Configuration mixin for constructors.","dist-tags":{"latest":"0.5.0"},"maintainers":[{"name":"jakeluer","email":""}],"time":{"modified":"2021-06-03T15:49:23.000Z","created":"2012-10-04T20:28:25.841Z","0.5.0":"2014-09-11T17:16:13.782Z","0.4.0":"2013-03-07T22:03:38.174Z","0.3.0":"2012-11-13T21:56:01.282Z","0.2.1":"2012-10-22T21:32:43.336Z","0.2.0":"2012-10-13T22:07:04.059Z","0.1.0":"2012-10-04T20:28:25.841Z"},"users":{},"author":{"name":"Jake Luer","email":"jake@alogicalparadox.com"},"repository":{"type":"git","url":"git@github.com:qualiancy/facet.git"},"versions":{"0.5.0":{"name":"facet","version":"0.5.0","description":"Configuration mixin for constructors.","author":{"name":"Jake Luer","email":"jake@alogicalparadox.com"},"license":"MIT","keywords":["configure","settings"],"repository":{"type":"git","url":"git@github.com:qualiancy/facet.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"mocha"},"dependencies":{"params":"^0.1.0","pathval":"^0.1.1"},"devDependencies":{"chai":"*","chai-spies":"*","mocha":"*"},"bugs":{"url":"https://github.com/qualiancy/facet/issues"},"homepage":"https://github.com/qualiancy/facet","_id":"facet@0.5.0","_shasum":"8ff34b6cbd59ba61d36e577e7fb3388353066e14","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"dist":{"shasum":"8ff34b6cbd59ba61d36e577e7fb3388353066e14","size":5310,"noattachment":false,"key":"/facet/-/facet-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/facet/download/facet-0.5.0.tgz"},"directories":{},"publish_time":1410455773782,"_cnpm_publish_time":1410455773782,"_hasShrinkwrap":false},"0.4.0":{"name":"facet","version":"0.4.0","description":"Configuration mixin for constructors.","author":{"name":"Jake Luer","email":"jake@qualiancy.com","url":"http://qualiancy.com"},"license":"MIT","keywords":["configure","settings"],"repository":{"type":"git","url":"git@github.com:qualiancy/facet.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"chai":"*","chai-spies":"*","component":"*","mocha":"*","mocha-phantomjs":"*"},"readmeFilename":"README.md","_id":"facet@0.4.0","dist":{"shasum":"a88231a7c0d6c503bd37274332147cd4e65dd3ce","size":3753,"noattachment":false,"key":"/facet/-/facet-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/facet/download/facet-0.4.0.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"directories":{},"publish_time":1362693818174,"_cnpm_publish_time":1362693818174,"_hasShrinkwrap":false},"0.3.0":{"name":"facet","version":"0.3.0","description":"Configuration mixin for constructors.","author":{"name":"Jake Luer","email":"jake@qualiancy.com","url":"http://qualiancy.com"},"license":"MIT","keywords":["configure","settings"],"repository":{"type":"git","url":"git@github.com:qualiancy/facet.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"chai":"*","component":"*","mocha":"*","mocha-phantomjs":"*"},"_id":"facet@0.3.0","dist":{"shasum":"1bf949d8a112e2045dda84259407def3deb62c1b","size":3462,"noattachment":false,"key":"/facet/-/facet-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/facet/download/facet-0.3.0.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"directories":{},"publish_time":1352843761282,"_cnpm_publish_time":1352843761282,"_hasShrinkwrap":false},"0.2.1":{"name":"facet","version":"0.2.1","description":"Configuration mixin for javascript constructors.","author":{"name":"Jake Luer","email":"jake@alogicalpardox.com","url":"http://alogicalparadox.com"},"license":"MIT","keywords":["configure","settings","prototype","extend"],"repository":{"type":"git","url":"git@github.com:logicalparadox/facet.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"chai":"*","mocha":"*"},"_id":"facet@0.2.1","dist":{"shasum":"5b3f64d671d48eb92fa1d380279ce45c78ea441b","size":2322,"noattachment":false,"key":"/facet/-/facet-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/facet/download/facet-0.2.1.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"directories":{},"publish_time":1350941563336,"_cnpm_publish_time":1350941563336,"_hasShrinkwrap":false},"0.2.0":{"name":"facet","version":"0.2.0","description":"Configuration mixin for javascript constructors.","author":{"name":"Jake Luer","email":"jake@alogicalpardox.com","url":"http://alogicalparadox.com"},"license":"MIT","keywords":["configure","settings","prototype","extend"],"repository":{"type":"git","url":"git@github.com:logicalparadox/facet.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"chai":"*","mocha":"*"},"_id":"facet@0.2.0","dist":{"shasum":"8933227421a545df055f929f62e965389dc93629","size":2267,"noattachment":false,"key":"/facet/-/facet-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/facet/download/facet-0.2.0.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"directories":{},"publish_time":1350166024059,"_cnpm_publish_time":1350166024059,"_hasShrinkwrap":false},"0.1.0":{"name":"facet","version":"0.1.0","description":"Configuration mixin for javascript constructors.","author":{"name":"Jake Luer","email":"jake@alogicalpardox.com","url":"http://alogicalparadox.com"},"license":"MIT","keywords":["configure","settings","prototype","extend"],"repository":{"type":"git","url":"git@github.com:logicalparadox/facet.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"chai":"*","mocha":"*"},"_id":"facet@0.1.0","dist":{"shasum":"6450028d97026a27968f5b0bbdf75e0faa376dd3","size":2214,"noattachment":false,"key":"/facet/-/facet-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/facet/download/facet-0.1.0.tgz"},"_npmVersion":"1.1.62","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"directories":{},"publish_time":1349382505841,"_cnpm_publish_time":1349382505841,"_hasShrinkwrap":false}},"readme":"# facet [![Build Status](https://secure.travis-ci.org/qualiancy/facet.png?branch=master)](https://travis-ci.org/qualiancy/facet)\n\n> Configuration mixin for constructors.\n\n## Installation\n\n### Node.js\n\n`facet` is available on [npm](http://npmjs.org).\n\n    $ npm install facet\n\n### Component\n\n`facet` is available as a [component](https://github.com/component/component).\n\n    $ component install qualiancy/facet\n\n## Usage\n\n### facet (object[, options])\n\n* **@param** _{Object}_ Constructor or Object\n* **@param** _{Mixed}_ Options \n* **@return** _{Object}_  Constructor or Object\n\nThis mixin provides a way to store arbitray key/value\npairs on a constructor or object. Furthermore, it provides\na number of helper methods to retrieve the stored values.\n\nBegin by applying the mixin to a constructor or object.\n\n```js\n// on a constructor\nfacet(MyConstructor.prototype);\n\n// on an object\nvar obj = {};\nfacet(obj);\n```\n\n**Storage:** Facet will default to creating and using the `.settings`\nobject on the constructor or object to store the\nkey/value pairs. If you would like to use something else\nyou may specify a different storage key.\n\n```js\nfacet(MyConstructor.prototype, '_options');\n```\n\n**Handle:** Facet can also invoke a handle anytime a setting is\nwritten. This is preferred method of responding to\nwrites as opposed to overwriting the `.set` method.\n\nThe `this` context in the handle will be the object\ninstance.\n\n```js\nfacet(MyEventEmitter.prototype, function (key, value) {\n  // emit changes on self\n  this.emit('settings', key, value);\n});\n\nvar ee = new MyEventEmitter();\n\nee.on('settings', function (key, value) {\n  console.log('%s was set to: ', key, value);\n});\n\nee.set('hello', 'universe');\n// \"hello was set to: universe\"\n```\n\n**All Settings:** If you are changing more than one of the\noptions than you can use an object as the second argument.\n\n- **@param** _{String}_ `store`\n- **@param** _{Function}_ `handle`\n\n```js\nfacet(MyEventEmitter.prototype, {\n    store: '_options'\n  , handle: function (key, value) {\n      this.emit('options', key, value);\n    }\n});\n```\n\n\n## API\n\n\n\n#### .set (key[, value])\n\n* **@param** _{String|Object}_ key or object\n* **@param** _{Mixed}_ value \n* **@return** _{this}_  for chaining\n\nModify a key/value pair of settings, or use\nan object to modify many settings at once.\n\n```js\nobj\n.set('hello', 'universe')\n.set({\n    hello: 'universe'\n  , say: 'loudly'\n});\n```\n\n\n#### .get (key)\n\n* **@param** _{String}_ key \n\nReturn the value of a stored setting.\n\n```js\nobj.get('hello').should.equal('universe');\n```\n\n\n#### .enable (key)\n\n* **@param** _{String}_ key \n* **@return** _{this}_  for chaining\n\nMark a setting key as \"enabled\" (true).\n\n```js\nobj.enable('loudly');\n```\n\n\n#### .disable (key)\n\n* **@param** _{String}_ key \n* **@return** _{this}_  for chaining\n\nMark a setting key as \"disabled\" (false).\n\n```js\nobj.disable('whisper');\n```\n\n\n#### .enabled (key)\n\n* **@param** _{String}_ key \n\nConfirm that a given key is enabled (=== true).\nSettings that do not exist will return `false`.\n\n```js\nobj.enabled('loudly').should.be.true;\nobj.enabled('whisper').should.be.false;\nobj.enabled('scream').should.be.false;\n```\n\n\n#### .disabled (key)\n\n* **@param** _{String}_ key \n\nConfirm that a setting key is disabled (=== false).\nSettings that do not exists will return `true`.\n\n```js\nobj.disabled('loudly').should.be.false;\nobj.disabled('whisper').should.be.true;\nobj.disabled('scream').should.be.true;\n```\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Jake Luer <jake@qualiancy.com> (http://qualiancy.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/qualiancy/facet","bugs":{"url":"https://github.com/qualiancy/facet/issues"},"license":"MIT"}