{"_id":"attr","_rev":"25-3cc266e63a0a3866802528209f383c80","name":"attr","time":{"modified":"2022-06-13T03:43:10.703Z","created":"2013-04-17T01:28:08.854Z","0.0.0":"2013-04-17T01:28:10.457Z","0.0.1":"2013-04-17T01:35:24.688Z","0.0.2":"2013-07-24T00:16:44.667Z","0.0.3":"2014-01-15T17:03:57.145Z","1.0.0":"2014-01-15T17:16:39.683Z","1.0.1":"2014-06-22T07:40:37.469Z","2.0.0":"2016-03-22T23:46:18.002Z","0.0.1-security":"2016-03-23T22:00:56.882Z","3.0.0":"2016-07-02T00:26:10.937Z","3.0.2":"2016-07-02T00:50:44.454Z"},"maintainers":[{"name":"macrofig","email":"hi@juanorozco.com"}],"dist-tags":{"latest":"3.0.2"},"readme":"# Attr\n\n[![Build Status](https://travis-ci.org/Macrofig/attr.svg?branch=master)](https://travis-ci.org/Macrofig/attr)\n\n> A basic getter/setter mixin that abstracts accessing a data map.\n\n> Special thanks to [@Krisk](https://www.npmjs.com/~krisk) for the NPM package name.\n\n## Installing\n\nUsing npm: `npm install attr --save`\n\nLatest code can be found here: https://github.com/Macrofig/attr\n\n## Usage\n\n```javascript\nimport Attr from 'attr';\n\nconst myObj = { name: 'Juan' };\nconst attr = new Attr(myObj);\n\nattr('name'); //> 'Juan'\nattr('name', 'Optimus Prime'); //> 'Optimus Prime'\nattr(); //> { name: 'Optimus Prime' }\n```\n\nor\n\n> NOTE: It is not recommended to append to the `Object` prototype. This is just a simple example on how to attach `attr` to your custom class.\n\n```javascript\nimport Attr from 'attr';\n\nconst myObj = { name: 'Juan' };\nObject.prototype.attr = Attr();\n\nmyObj.attr('name'); //> 'Juan'\nmyObj.attr('name', 'Optimus Prime'); //> 'Optimus Prime'\nmyObj.attr(); //> { name: 'Optimus Prime' }\n```\n\n\n## Build\n\nThe code is in ES6 but it can be transpiled into AMD, CommonJS, or global modules.  If you are using the NPM package, the `dist` is already available to you.\n\n- Clone to your machine: `git clone https://github.com/Macrofig/attr`\n- `cd attr`\n- `npm install`\n- Run the build `npm run build`\n\nThis will create a `dist` folder with three bundles, one for each of the following:\n\n- AMD\n- CommonJS\n- Global\n\nUse the appropriate bundle as needed. :)\n\n## Tests\n\nMake sure you have installed the dependencies (see \"Build\" above) and have Firefox installed on your machine.\n\n**Command line:**\n\nSimply run `npm run test`.\n\nThis will run tests using Firefox so make sure it is installed first.\n\n**Browser:**\n\nSimply run `npm run develop`. This will attempt to start a web server on port `8001`, if successful, it will open your default browser.\n\nBrowse to `/tests.html`. Tests will run in the [Mocha](https://mochajs.org/) browser using [StealJS](http://stealjs.com/) and [Testee](http://daffl.github.io/testee.js/).\n\n## Future\n\n- Test coverage\n- Better documentation\n- Access deep properties with `.` (dot) operator. `myObj.attr('name.last')`\n- Hookable getter/setter. Create any plugin needed to change getter or setter behavior.\n- Get multiple items by passing array (filter): `myObj.attr(['name', 'npm']);//> {name: 'Juan', twitter: 'macrofig'}`\n\n\n## License\n\nMIT License\n\nCopyright (c) [2016] [Juan Orozco]\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 all\ncopies 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 THE\nSOFTWARE.\n","versions":{"2.0.0":{"name":"attr","version":"2.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"attr@2.0.0","_shasum":"aa413f38cb32bd74c340560a1901c0faef38c303","_from":".","_npmVersion":"3.7.2","_nodeVersion":"4.3.0","_npmUser":{"name":"nj48","email":"spam@njohnson.me"},"dist":{"shasum":"aa413f38cb32bd74c340560a1901c0faef38c303","tarball":"https://registry.npmjs.org/attr/-/attr-2.0.0.tgz","integrity":"sha512-0f3zfCwZmjgx4FPjWf1EWit3ng3oqvG/AQyV0/P+slSPXvbtqlzqBdxat9EUXhMOe9rY42+/uXQ9RJ6hnE2fBQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCd+PBoFsnYYwmSUWWXCdxoSYsfcTTQ3paAzzt890VrwIgaO4ErzqU/7hV/RrVvbIiMqba+Pe8HLYlsg0q3QKof5k="}]},"maintainers":[{"name":"nj48","email":"spam@njohnson.me"}],"directories":{}},"0.0.1-security":{"name":"attr","version":"0.0.1-security","description":"This package name is not currently in use, but was formerly occupied by a popular package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/npm/security-holder.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/npm/security-holder/issues"},"homepage":"https://github.com/npm/security-holder#readme","gitHead":"d1719e2a152734ed854065de56039770c9104d83","_id":"attr@0.0.1-security","_shasum":"c81805ffd07495eee4ed1b55bc1695b783b7121e","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.1.0","_npmUser":{"name":"npm","email":"npm@npmjs.com"},"dist":{"shasum":"c81805ffd07495eee4ed1b55bc1695b783b7121e","tarball":"https://registry.npmjs.org/attr/-/attr-0.0.1-security.tgz","integrity":"sha512-5O2u/woMubN+4H6beN/GgfEZznHr+KaabOttDcOqM+llwvoSZbkyjTw6i69WDgDxde2oMDGla8ELUvP3qelptQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIjF4/ZserI6lXWoVpFcV21TuJaVZb3z9kHTwOD9Y6qwIhALsGlJvpNHavyXPTP1oWbutuXnHnSCJAmNhUtglTo44H"}]},"maintainers":[{"name":"nj48","email":"spam@njohnson.me"}],"directories":{}},"0.0.0":{"name":"attr","version":"0.0.0","description":"Properties with PubSub","main":"index.js","scripts":{"test":"fox"},"dependencies":{"new-pubsub":"*","new-prop":"*"},"devDependencies":{"fox":"*"},"repository":{"url":"git@github.com:azer/attr.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"attr@0.0.0","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"8d119bb2361dde44f563abd9102fc49ffb422c2e","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"8d119bb2361dde44f563abd9102fc49ffb422c2e","tarball":"https://registry.npmjs.org/attr/-/attr-0.0.0.tgz","integrity":"sha512-+tEwUXRj0VqPvD8TBeecpXp/D7Er2gMUxrPczgDukJZa5/YXzZlu5FGLWqCKmRylAqBQoAHav/Ar+wav/Ke3bw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHhsy8l6Io5YTLUWUjEczuCQmxS53AcekGPThvk9M83GAiEAsIGW7L8Cy89dycPkx+oRjIPdMyxCNTVQeyKzXT1cyfs="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"0.0.1":{"name":"attr","version":"0.0.1","description":"Properties with PubSub","main":"index.js","scripts":{"test":"fox"},"dependencies":{"new-pubsub":"*","new-prop":"*"},"devDependencies":{"fox":"*"},"repository":{"url":"git@github.com:azer/attr.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"attr@0.0.1","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"1797c17e30ca520cb4ac8ec3d0cd9d218b9f8b3b","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"1797c17e30ca520cb4ac8ec3d0cd9d218b9f8b3b","tarball":"https://registry.npmjs.org/attr/-/attr-0.0.1.tgz","integrity":"sha512-IqHl1R9/Z4wMs8iNHYXfzjtxnSPp6zkf7AhXbuRGAnN3gO/594LQPBlABTXaVY8nyHlPP5lIpi8P+9f+AIzyVA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDW5sMbINENPuHDrZVft9slQXB0GIqIyTfDWjorHSeFrwIhAIjC11pcDCvYlSGASx6VU1PNL+xk4lHkBquaORHWQPcQ"}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"0.0.2":{"name":"attr","version":"0.0.2","description":"Properties with PubSub","main":"index.js","scripts":{"test":"fox"},"dependencies":{"pubsub":"*","property":"*"},"devDependencies":{"fox":"*"},"repository":{"url":"git@github.com:azer/attr.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"attr@0.0.2","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"0e50913c52fc33dbb87cd7e87f65c847f8a5edb3","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"0e50913c52fc33dbb87cd7e87f65c847f8a5edb3","tarball":"https://registry.npmjs.org/attr/-/attr-0.0.2.tgz","integrity":"sha512-r9mEQ/Hfbk0xF8rmfNl1XvL6nXk+9cF70PFGW0H6Zv2iW6qxqrY2vOA+gOVxH+NIDx0QicK4LhmciVboSWkVXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEUx0937cGLnUFHcluGGed1k0P45CR6xnGZeqpgx/08wIgMvoXVcmQ1iwbdamzQauBM7SoIjnlPp4bQbDHGyVwyLQ="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"0.0.3":{"name":"attr","version":"0.0.3","description":"Properties with PubSub","main":"index.js","scripts":{"test":"prova"},"dependencies":{"pubsub":"0.x","property":"0.x"},"devDependencies":{"prova":"*"},"repository":{"url":"git@github.com:azer/attr.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"attr@0.0.3","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"ef2a7b240dec5e2a518212a2297584756723d651","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"ef2a7b240dec5e2a518212a2297584756723d651","tarball":"https://registry.npmjs.org/attr/-/attr-0.0.3.tgz","integrity":"sha512-d5Reo7Rq+QUSZHz6Vt83Zo7jW1vTYYsnaABKY1Z8Zn6G4nonjwC9ny9c7KKmk8BLAvhF9MY2Y4A4SHB992Qxig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDj6FUd+Ia4U8Y4vWrk4dYmhwV0Cjou+oGazLy+VgtZ1wIgaug0cdw775a3PU/+4Kj5Igtw2puSEo/mjHxQ7mJpQYo="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"1.0.1":{"name":"attr","version":"1.0.1","description":"Define values that you can subscribe for changes","main":"index.js","scripts":{"test":"prova"},"dependencies":{"pubsub":"1.x"},"devDependencies":{"prova":"*"},"repository":{"url":"git@github.com:azer/attr.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"attr@1.0.1","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"d7c04e4c4261d053e3ad5faea673bf7c22e02eda","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"d7c04e4c4261d053e3ad5faea673bf7c22e02eda","tarball":"https://registry.npmjs.org/attr/-/attr-1.0.1.tgz","integrity":"sha512-QCWUKE2/iGfvu1HqdeZM8imW4DO3D4qes2AT5Fr5Ocu/8L+bA6HPVgTJB2xoEVLJcOmmrR8bGbnPEC4KztPmZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+uBvjxejQPJ0HC8Jh3QsyGR2CiGeAKR1JB8IPDZ84NwIgQ279CN5eJx089UU1i4ctjYUemEAGC1VxSOAuHkUshL8="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"3.0.0":{"name":"attr","version":"3.0.0","description":"A basic getter/setter mixin that abstracts accessing a data map.","main":"attr.js","scripts":{"build":"node ./bin/build.js","lint":"xo","test":"xo && testee --browsers firefox test.html","prepublish":"npm run build","publish":"git push origin --tags","release:patch":"npm version patch && npm publish","release:minor":"npm version minor && npm publish","release:major":"npm version major && npm publish","document":"documentjs"},"keywords":["attr","object","getter","setter"],"author":{"name":"Juan Orozco","email":"hi@juanorozco.com","url":"http://juanorozco.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","debug":"^2.2.0","documentjs":"^0.4.4","mocha":"^2.5.3","steal":"^0.16.22","steal-mocha":"0.0.3","steal-tools":"^0.16.5","testee":"^0.2.5","xo":"^0.16.0"},"system":{"ignoreBrowser":true,"npmIgnore":["documentjs","testee","steal-tools","xo"],"npmAlgorithm":"flat","npmDependencies":["steal-qunit"],"paths":{"mocha":"node_modules/mocha/mocha.js","chai":"node_modules/chai/chai.js"},"meta":{"mocha":{"format":"global","exports":"mocha"},"chai":{"format":"global","exports":"chai"}}},"xo":{"esnext":true,"space":4,"envs":["node","mocha"],"rules":{"no-lonely-if":0,"no-else-return":0,"spaced-comment":0,"no-warning-comments":0},"globals":["steal","chai"],"ignore":["node_modules/**","dist/**","docs/**"]},"gitHead":"ce7f3e10e01204146fd86594a8beef8e9ce92458","_id":"attr@3.0.0","_shasum":"411276998956ed1498d6161a08cd1e052e331bb0","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.2.0","_npmUser":{"name":"macrofig","email":"hi@juanorozco.com"},"dist":{"shasum":"411276998956ed1498d6161a08cd1e052e331bb0","tarball":"https://registry.npmjs.org/attr/-/attr-3.0.0.tgz","integrity":"sha512-MC0Jjtlp4w+yFWw9MZcEK4o2mpCHMeh56u6iDctwkPTbXhbl67vVny7hqqMbVRNwcbW2braJc1Xh2tG4GnyRzQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHNRr9LdRMaKpobG7ap1WqDrPYRB3Whxc9l1Qrhaf/46AiEAwO1di6BlDWNVdddNuNxosfyTO4IRJ0Z4mUIuF6oqnE4="}]},"maintainers":[{"name":"macrofig","email":"hi@juanorozco.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/attr-3.0.0.tgz_1467419168902_0.08484564791433513"}},"3.0.2":{"name":"attr","version":"3.0.2","description":"A basic getter/setter mixin that abstracts accessing a data map.","main":"attr.js","scripts":{"build":"node ./bin/build.js","develop":"http-server -c-1 -o -p 8001","lint":"xo","test":"xo && testee --browsers firefox test.html","prepublish":"npm run build","publish":"git push origin --tags","release:patch":"npm version patch && npm publish","release:minor":"npm version minor && npm publish","release:major":"npm version major && npm publish","document":"documentjs"},"keywords":["attr","object","getter","setter"],"author":{"name":"Juan Orozco","email":"hi@juanorozco.com","url":"http://juanorozco.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","debug":"^2.2.0","documentjs":"^0.4.4","http-server":"^0.9.0","mocha":"^2.5.3","steal":"^0.16.22","steal-mocha":"0.0.3","steal-tools":"^0.16.5","testee":"^0.2.5","xo":"^0.16.0"},"system":{"ignoreBrowser":true,"npmIgnore":["documentjs","testee","steal-tools","xo"],"npmAlgorithm":"flat","npmDependencies":["steal-qunit"],"paths":{"mocha":"node_modules/mocha/mocha.js","chai":"node_modules/chai/chai.js"},"meta":{"mocha":{"format":"global","exports":"mocha"},"chai":{"format":"global","exports":"chai"}}},"xo":{"esnext":true,"space":4,"envs":["node","mocha"],"rules":{"no-lonely-if":0,"no-else-return":0,"spaced-comment":0,"no-warning-comments":0},"globals":["steal","chai"],"ignore":["node_modules/**","dist/**","docs/**"]},"gitHead":"16150f56134d2df62ef2c7b82bb63dfeac32422d","_id":"attr@3.0.2","_shasum":"9e75ca1156e72a52d36ce65092b2aa7f339f8d9e","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.2.0","_npmUser":{"name":"macrofig","email":"hi@juanorozco.com"},"dist":{"shasum":"9e75ca1156e72a52d36ce65092b2aa7f339f8d9e","tarball":"https://registry.npmjs.org/attr/-/attr-3.0.2.tgz","integrity":"sha512-V+uDVi+8wdZhENhfvYY6m15mXpXPA79r74i6EO4uG4/9rP9gPCF/v8rc5AtF/fmIrGcDAoGRfoC2h853PiZhVw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDqbQwfuJ7ZQsZ6VsjAJ2PS6hwnUGcx5KxetwRHU9HGdAiEAvkA3K9FKTtTW38ITxfePCPLr2I3r/YCXPXSd56ZXpxM="}]},"maintainers":[{"name":"macrofig","email":"hi@juanorozco.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/attr-3.0.2.tgz_1467420642132_0.990592836169526"}}},"license":"MIT","readmeFilename":"readme.md","description":"A basic getter/setter mixin that abstracts accessing a data map.","keywords":["attr","object","getter","setter"],"author":{"name":"Juan Orozco","email":"hi@juanorozco.com","url":"http://juanorozco.com"}}