{"_id":"@benderthecrime/collections","_rev":"1-a1d50546fe20a139227f5cde08424bfb","name":"@benderthecrime/collections","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@benderthecrime/collections","description":"Helpful collections shamelessly copied from Python and ported to JS: orhttps://docs.python.org/2/library/collections.html#module-collections","version":"1.0.0","main":"index.js","keywords":["collections","default","defaultdict","defaultobject","counter"],"maintainers":[{"name":"benderthecrime","email":"joe.groseclose@gmail.com"}],"scripts":{"test":"mocha ./**/*.test.js"},"license":"MIT","devDependencies":{"chai":"^4.2.0","mocha":"^7.1.1"},"gitHead":"730af43f55f2555c3f6dcfd5db4f909626bfd775","_id":"@benderthecrime/collections@1.0.0","_nodeVersion":"12.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-CJC570gaHe+S48LuEEH+CyHqJiuXdkD2gwSbQJZNSfNMAQgCBc8EhR6k57SQmyEYEGb9hW/VkP/ZwMcUGL7iow==","shasum":"dc9c870d80af60121f4b27c0db495301713f4ba1","tarball":"https://registry.npmjs.org/@benderthecrime/collections/-/collections-1.0.0.tgz","fileCount":5,"unpackedSize":2863,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeiOGHCRA9TVsSAnZWagAAH1sP/jwuSYpWtadVLUS7S8EO\nr6DuEI8hmZ36oAy5mkioi4I6GZie/doQAJ6i89tsAh7v9QQ1PE3TgeP6SKm3\nQSllq8O32rpExjgRao7yN7HGhef+3zpw4CWNwBnNMKOxfZK0HoU1whQUoXiN\n6jonTc4XVlqzAUNh9tgqE/AmHxqNN06+As33nR28j6yN1GwNRUJUtbti96q2\nlBJQ5y25aPG8EJTI0agKAzlkDCiAHw6bKFgjSgYhqxdfGG13SN9uu4tz4gSU\nsm1MyXo+J0dSLYfr44g+AomyXerYkdbbT99apR7FUWx5qfjcZPgTjHHhjELm\nBLmOEKClLTlPzJJ/qATaHxNKhxVchPPn/PwymayieP/HjsqpcDQ/Set+/oL+\nAgZxYcUNAQih/edMP5a5x/YoTpWSRU900cQMdC+Bf7WwonTJcJv813HGgjTl\nxwQVnMxMp01jyZgyn4rs0iiqCcU8B0G/nKHN3gU3VAYslbzXjw7D0LtLzpuE\n2QjPolkzOne42hpF/Xf5ZzoyiLvyxTRwxRJjzMOH9cm3ySIcGiMBQvL7KSpe\nWsfoEQx3yv6GxV+2uy9/VAvY/5z9/ZrBE47djMGEy4rpr2SEXp4cf2iE8U3w\n0bki0C90HN2O2zyRfKXSMb46P9+L0Oc1qN26bzS758iC5FFiG8LYyo7Mi5Ed\nr8aD\r\n=uIM8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDAsni9YbV1jlz9+2MtC614WRMBHL/pOk3ZsfgHUk1Z1AiEA3Km7PK0a5KXiSZva13NvBqtB6WGtXdFhXqZ1XHnH0/I="}]},"_npmUser":{"name":"benderthecrime","email":"joe.groseclose@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/collections_1.0.0_1586028935115_0.2803999544875131"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-04T19:35:34.860Z","1.0.0":"2020-04-04T19:35:35.246Z","modified":"2022-04-04T18:22:03.342Z"},"maintainers":[{"name":"benderthecrime","email":"joe.groseclose@gmail.com"}],"description":"Helpful collections shamelessly copied from Python and ported to JS: orhttps://docs.python.org/2/library/collections.html#module-collections","keywords":["collections","default","defaultdict","defaultobject","counter"],"license":"MIT","readme":"# Collections\n\nHelpful collections shamelessly copied from [Python](https://docs.python.org/2/library/collections.html#module-collections) and ported to JS.\n\n## Installation\n\n```sh\nnpm i @benderthecrime/collections\n```\n\n## Usage\n\n### DefaultObject\n\n```javascript\nconst collections = require('@benderthecrime/collections')\nconst {DefaultObject} = collections\n\nconst collector = DefaultObject(Number)\nconst values = ['a', 'b', 'c', 'd', 'a']\n\nfor (const value in values) {\n    // No need to check to see if the value already exists in the collection.\n    collector[value] += 1\n}\n\n// Works with scalar values too!\nconst defaulter = DefaultObject(null)\n\n// And custom classes!\nconst defaulter = DefaultObject(Test, 'some argument', 'another argument')\n\n// You can even make a DefaultObject inside a DefaultObject!\nconst collectoe = DefaultObject(DefaultObject, String)\n```\n","readmeFilename":"README.md"}