{"_id":"o-pubsub","_rev":"5-3977ea7f6605b4fd00a2d2a962da2e41","name":"o-pubsub","dist-tags":{"latest":"2.1.0"},"versions":{"1.0.1":{"name":"o-pubsub","version":"1.0.1","description":"Object matching publish/subscribe pattern","main":"index.js","scripts":{"test":"mocha src/**/*.spec.js","cover":"./scripts/cover.sh"},"repository":{"type":"git","url":"git+https://github.com/Wushen42/o-pubsub.git"},"keywords":["pubsub","pattern","matching"],"author":{"name":"Wushen42"},"license":"ISC","bugs":{"url":"https://github.com/Wushen42/o-pubsub/issues"},"homepage":"https://github.com/Wushen42/o-pubsub#readme","dependencies":{"assert":"^2.0.0","express":"^4.17.1","mocha":"^8.1.1","nyc":"^15.0.1"},"gitHead":"11b7c7c6b0af7837cbfdab78372975d4447c9722","_id":"o-pubsub@1.0.1","_nodeVersion":"14.7.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-V+h5+3zXeToxSQAyvdBjHqwinFYZnz0p8KdkPZ/JhBWbuGbcmaiuMqE5TSPmv2WanIEdvn0rlep0hYG1Esrb4Q==","shasum":"f2b179dd5e512aeb860136e73b28f5f5188fdc4e","tarball":"https://registry.npmjs.org/o-pubsub/-/o-pubsub-1.0.1.tgz","fileCount":18,"unpackedSize":19289,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLYXmCRA9TVsSAnZWagAAe5EP/jJaDfYCrDgs3vcRufOo\nBBpuFnZ1lub6gOicV8z8XqaQETY4Y81Ri89yjfmnx7g6+Xd6J6l2aw8BRjkK\n4G2qEqqWpWH2UuTVyFfd/XwnmdF8JISigtMI5Hteuv8XzXJyV/Xu7qmo6vH+\nQt0SPWLu9BYU4132uD0cWKzX0LpAmKgEM/OS+N3gXsReAyN6gedVP7Yh06Om\nd0n0lURSCM2rm3b23RdUBDlu9fPc0J8257llrBsmF4lnFp3HNyYQmXENAe4s\nouppJJTz4xPm1vwChRstSAiVIG98iJAKdfxRnbDhDmdiy+rkNlfO70+ooi36\n4lNFaLO6qX/OkMiXTgZi6gOYU7a+wlb2GrH7QL6IlyhsDOsK8z/0yscKINBL\nCLuVoxMmjZMbNHD+IxKmREYgPXKe59DWOkchO8xoLnb7aq0sWm4ERRj+z99c\ne/RURMHUb0ySySQgY9GqFV3Q5uk5y1W+JDtaQAivaVRYyXnbOIl+N4wm36Av\nQ26tcjU5i/m66CvWOYjgzgI3bKoX8NyGbbhmoYhE4dSdNWw7a/qn+Dsy0dB1\n4v2bXP2K1Gw7VcV02PaSgaL3wZibjlXGdoVGgc8XIvG25KC/2tp0W+hMwNSd\nhrtDaxmOAE7pCZiXGZPUzmM2N65arXgVHdFyVvHlS8fNnF0mp3+YrKb5Trn1\nls3n\r\n=1Ze7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRJtaOXDevSdWJJuEh4Y4lQGUcpq9s5Re7oU+yqn6IjAIhALkgiyortcrsSJaPK65wiFvV8VXBsGsJRY7VKdJmbbtJ"}]},"maintainers":[{"name":"wushen42","email":"renaud.reguieg@gmail.com"}],"_npmUser":{"name":"wushen42","email":"renaud.reguieg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-pubsub_1.0.1_1596818917933_0.9925267539214759"},"_hasShrinkwrap":false},"1.0.2":{"name":"o-pubsub","version":"1.0.2","description":"Object matching publish/subscribe pattern.Don't bother with topics, subscribe to the data itself","main":"index.js","scripts":{"test":"mocha src/**/*.spec.js","cover":"./scripts/cover.sh"},"repository":{"type":"git","url":"git+https://github.com/Wushen42/o-pubsub.git"},"keywords":["pubsub","pattern","matching","eventbus"],"author":{"name":"Wushen42"},"license":"ISC","bugs":{"url":"https://github.com/Wushen42/o-pubsub/issues"},"homepage":"https://github.com/Wushen42/o-pubsub#readme","dependencies":{"assert":"^2.0.0","express":"^4.17.1","mocha":"^8.1.1","nyc":"^15.0.1"},"gitHead":"76d4958d032adbd57b5bf37e9aff120f34cd5dd4","_id":"o-pubsub@1.0.2","_nodeVersion":"14.7.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-b13KRY8RHod8HJW2SuX3569o4/lzvzZ92eDj1DARyQBOKKIjOpmE/A27/PpUOxHrIu9pSf7fqkNJh/+oPwZsbA==","shasum":"e87e40687fb9ec8e688fa4e5a7e4a267000c7404","tarball":"https://registry.npmjs.org/o-pubsub/-/o-pubsub-1.0.2.tgz","fileCount":18,"unpackedSize":19360,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLad3CRA9TVsSAnZWagAAM70P/1cx3S44RXmm/nwzPHcF\nLkFlGf3C8Z8oT8pUQ2ErpN0tMpU90mm9bxfckbfv6gqnSh1yWiDl1eLJ+QrH\nD/M+eMsN3eWWlzjfaLNirdkdmSLXnUpKicC1FlQCulZb/69CNo39Cmqm3oPP\nNRMZ2rXk1WS/YEEWeFkU2dRcJNcijjFWgHZxC9n9O9NFvDZA0z37sDoOId00\n/ovIBIX3lvUcs1y4fjHYDqTgl4yxP44ELwD1PAkMYqmwAKd/541yn3B5kq3b\nWI7+cGnIGUdHNE0w9S7Osq8S2jERo8kjV1euTChO14eXUsPOqAK2DY+3XOvm\nKau0lQkXNQCSb63eG4ISejHwpwHzBa9mE2XprqUUMuvlLehOFYoVwr0xM7oZ\nijAUg+mvlN3iJdHvr9pT560tQav6NbglN81m/OYA6N3jCrtgEkvxu7sGoAEw\nzVx8rUzpHTOGY62+1KCnW53n5dDB8oDRp14aeRqy2C+z58l+rFmMRTI487NB\n/MyonXfogTrXNECByWIk1ZfddGJNdPv+o8zPkO+QPS/RoDwoMtlhcIanBI1F\nbt5jZpcfv9KXTojNx8PrTSj5d7KZyi7uqp3iL90+X4dvgKSCRVotaiLXLlg2\nRkkWxYjdoWlKE5sZI5Slg2UkmyH0NnuvnyOEUvcONocATcLPNj5ZLgQHHWHZ\nneDI\r\n=fE0l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICyqKFy5qCQv/A92Qh9vDkODaq4gT0qpdZeMeNRxXMC/AiBLqb4Vg6Z1uToVcoygESv11wk0hKk8Zam3tdsuBq2cZA=="}]},"maintainers":[{"name":"wushen42","email":"renaud.reguieg@gmail.com"}],"_npmUser":{"name":"wushen42","email":"renaud.reguieg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-pubsub_1.0.2_1596827510892_0.6737461430192613"},"_hasShrinkwrap":false},"1.1.0":{"name":"o-pubsub","version":"1.1.0","description":"Object matching publish/subscribe pattern.Don't bother with topics, subscribe to the data itself","main":"index.js","scripts":{"test":"mocha src/**/*.spec.js","cover":"./scripts/cover.sh"},"repository":{"type":"git","url":"git+https://github.com/Wushen42/o-pubsub.git"},"keywords":["pubsub","pattern","matching","eventbus"],"author":{"name":"Wushen42"},"license":"ISC","bugs":{"url":"https://github.com/Wushen42/o-pubsub/issues"},"homepage":"https://github.com/Wushen42/o-pubsub#readme","dependencies":{"assert":"^2.0.0","express":"^4.17.1","mocha":"^8.1.1","nyc":"^15.0.1"},"gitHead":"8679d29f4b0dae4c67f173586738a980db5a5b0b","_id":"o-pubsub@1.1.0","_nodeVersion":"14.7.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-rmxlb0Euncm4lNCGfQ+ljFeRlZrYgBUyAtcpajGPY983bTUoKi8bJJqWmKlV/6MBYiI+qvvQoJhjM+/tjgCTWQ==","shasum":"1ff8406e16165fcbb2a3eb252bf8d34749ea45b8","tarball":"https://registry.npmjs.org/o-pubsub/-/o-pubsub-1.1.0.tgz","fileCount":18,"unpackedSize":19393,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLa6uCRA9TVsSAnZWagAAEeUP/0znoa/9dZXKg6ohrfdr\nS38FFtid3M1MlLQnhmZ5924Dbkn+xraXmOXrory1IWPoKpmpPRggSXMiiz9b\neHogBKxE/dSjtNBVNcVm/BznlI7ffvAlTQDOqf4TcMASC2AxJ6602+eZ1IVj\n/y47VJH7CWsZ1mysJVLiGEp9SEkcd5ciOe5T2l/bEzQNLcAI1Zg5rcyjBCAi\nOtDfPlsg7DNxvtX2OQaVtNJR7TlP72KS1UdUZP29Dm+MhLgX+X1nLbxrOotm\nXFv9KQj1HJUkYPk2K3NWD2GQpAVQtk2fYS+bzOrMIzBCYEzkD9qKzAngdpVj\nrVpmyIgTZ7JqoN1FxrS+hGgi1YhgUofavrtYakSTV+sXDdC1tgBqROt/wM5H\npX4/FSQuAGPn3ubWclLGeCoJ7oWYiivHoK5CJFqKHcnludKbbAN+as6ClvMd\nbKWwDjzpm3moQpYi1ecSYZ6YmWzSAnjbI8YptT34q9/ZJNvucPJx00fk1CUv\nnA+3WnSWZWMqnDO5EiQEqtEOgB+r2rCen+9HzwKZnRL5mxuMDfUtcXBikd8M\nGG+j099NTTuofezHeivgWau0ywOv2/IzyDRMRPyzUpuktHwdRfAwqGKdxsab\nwVWnmEyMp6EoZKp16I7C9uT/1R6//U4Wqh60hY6UYt0u+KNbK5U2d45iA7aG\nC7+O\r\n=mEMq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAuI5z7FwMAl1txsasNtMDZKhn0MjXevgx98mVdEgbzaAiBy5A8NpiRTqpkAg2uU8fEKB+V/UpzynARMnZt78PoFHA=="}]},"maintainers":[{"name":"wushen42","email":"renaud.reguieg@gmail.com"}],"_npmUser":{"name":"wushen42","email":"renaud.reguieg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-pubsub_1.1.0_1596829357553_0.7218706637224743"},"_hasShrinkwrap":false},"2.0.0":{"name":"o-pubsub","version":"2.0.0","description":"Object matching publish/subscribe pattern.Don't bother with topics, subscribe to the data itself","main":"index.js","scripts":{"test":"mocha src/**/*.spec.js","cover":"./scripts/cover.sh"},"repository":{"type":"git","url":"git+https://github.com/Wushen42/o-pubsub.git"},"keywords":["pubsub","pattern","matching","eventbus"],"author":{"name":"Wushen42"},"license":"ISC","bugs":{"url":"https://github.com/Wushen42/o-pubsub/issues"},"homepage":"https://github.com/Wushen42/o-pubsub#readme","dependencies":{"assert":"^2.0.0","express":"^4.17.1","mocha":"^8.1.1","nyc":"^15.0.1"},"gitHead":"945b2b7642947552be65c9aeffcdc3fbcde96774","_id":"o-pubsub@2.0.0","_nodeVersion":"14.7.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-Veds3FbgDc6HDT3iq/dENipOqIQldiOg2R5XdWGxSm8d/SnqDB6aN/SkFCC1kYkHfOlPbZ52dqlU000+xLLamQ==","shasum":"f4362e690508124e578c76ce065c55cabbad3357","tarball":"https://registry.npmjs.org/o-pubsub/-/o-pubsub-2.0.0.tgz","fileCount":18,"unpackedSize":20578,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMPqGCRA9TVsSAnZWagAA5qoP/0hatfVb/n1ZUMAvR9Ek\nMR/wwxX+ptU+ceZnl3UzidetybAS4fAEKhmwP3h7Y12cZ2wcugAO3uWU+avj\nRLIkmj2i3A8E149oM0NKyYdIVHG3BUl6tJGapoSWiW7GiGsY4wLrrcyMkxfu\nhBXm0kSzZSgLeXNjfGI2f/SaFOfKtAO5VPDeoxr7WKy5ARLo03OLmHzvwZid\nOA19XGARWqcAYD/QBxXUS4L359TQzB/ILPOVLabsbxtYQVi72bj3gB+iCil7\nenoMtLntTxOfixm6PiIE4Q3K2XZeur5UqpEpYCcrVf6SuS+LCOJeZvIfu0KX\nOEyNmUfcyXNr1og2cuMYQEFylZyAIAD2tonTzSjdYt0L5C4lAwOJ2Py7wMKa\n8/Zpmw7hPm9fJe4D0ulWbd728+raMUXTG8QzSeaRDcHLLlmmS/352toMA5W4\n5eHejP/0WqRHrHxTdLRWF3Cyb/wqv1+AYCjnEEYlwp1fV1Edf0in725Vx44s\n2ZkFx+pCCWpx4zmcWyWRKHIkg+t6SDrObUiyyGSoVw3m2Z+oMHr740YztE5u\n9vvnEDCIM3cybtGdTEa8v6ed7d0jLj10Bt2cBMGvOIjOUNHwFpMWxq2A82Wl\nM+KawuSGQOlpByP4v8XyZ1z4s0KDR6+xvgeuR9HlHk48Cxred+kUUJ9LXahh\niJAb\r\n=HTNQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG9maoPnYBOJno27laK7bwUWPEln6bIIezT66kDB5BZuAiEAjL1hD4GYYoOgdih8nxNQC6uZxLfs5M3QiZNyFrPaaGo="}]},"maintainers":[{"name":"wushen42","email":"renaud.reguieg@gmail.com"}],"_npmUser":{"name":"wushen42","email":"renaud.reguieg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-pubsub_2.0.0_1597045381841_0.01352219811212585"},"_hasShrinkwrap":false},"2.1.0":{"name":"o-pubsub","version":"2.1.0","description":"Object matching publish/subscribe pattern.Don't bother with topics, subscribe to the data itself","main":"index.js","scripts":{"test":"mocha src/**/*.spec.js","cover":"./scripts/cover.sh","lint":"eslint ./src","format":"eslint --fix ./src"},"repository":{"type":"git","url":"git+https://github.com/Wushen42/o-pubsub.git"},"keywords":["pubsub","pattern","matching","eventbus"],"author":{"name":"Wushen42"},"license":"ISC","bugs":{"url":"https://github.com/Wushen42/o-pubsub/issues"},"homepage":"https://github.com/Wushen42/o-pubsub#readme","dependencies":{"assert":"^2.0.0","express":"^4.17.1","mocha":"^8.1.1","nyc":"^15.0.1"},"devDependencies":{"eslint":"^7.7.0"},"gitHead":"fd1e455631bf90c3096db23bb84e1e9bee27b691","_id":"o-pubsub@2.1.0","_nodeVersion":"14.7.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-t0ZsTiBuXO2DzxBWg+1qZzMsBwSQi4Bl2lYmVTdOcXx5bylIao0w42dtnucwTCQUtQ6eDjGLsfcAIN0Tj0PfDA==","shasum":"94194a16c2ba05050764670a96b8efe81d25ad2d","tarball":"https://registry.npmjs.org/o-pubsub/-/o-pubsub-2.1.0.tgz","fileCount":19,"unpackedSize":21245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfPM0YCRA9TVsSAnZWagAA1fQP/10DbOou6lqAUSd6d+o/\nuQvcGELdAs8Kdb4BXCv/GoGL04QemvJod8SAhFw3h9dr/jfAHXp1k0tZMBch\nPlvEa6xrIGSJ9OouU04goy5wXdQxr+JAnT5FD5epi7OCmhiE7/YqoZS3o4vV\n0ltnrx3qPwtDzd9u/ros6e5+kBSY47z3UeHo3IpkBTq9OGFSKBLiRL5pHAhp\n0kIFwid6rX2EnnKmONrfq7XgwgXDk8+zRbaNfqCZ2CNMymGTJkEElUdIFCJN\nDxUkXp9r+K9SUZ9G0U8rFT76A/lMKgV7WAFQti8w0EO9/ndxeUB3DU5J4hlG\nS2pSYOT6nZHwi/S7haO/0C/v1PYXm6WPBiEl9wZ6gnvusmSQWTUN9q1NEZ5X\nnFPj8UpgENqkTFe/1ZI8Hi0nYHsM3RuSr7eGc88r/6aB8l6dd51GwR2dkdUV\nDx+p2VN4En3/HcNsQZW5IidAXaQ9OR2KeRCVChnQy+y0hEh9dH3C7mtX2aDL\nA8M0kg6QzhbhhnxZORd4f31Rz/rCQ4gHuURYX2DqLAypci4ZC3hBVPm01y/b\nlD4mN3gekMWx/Oaa+EFiIOqb7Z07+ANc+ZNyonWwPErXs1a+T1fxYSTjKDxA\nfzD4J8xPNsosAlhDxYEKmNEMycd1Ycl2R3atZDJtPdamNeImMhW4dX2gLd3E\nwXDB\r\n=CGhg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGU2xNiXjZCAaRlWPVt5vez+YXsq5Df/IQnnCXKVBiVdAiEA9cvh/XjZz+18tW+xp8UH5AsPE8Fkp5J75cTOcKHn11Q="}]},"maintainers":[{"name":"wushen42","email":"renaud.reguieg@gmail.com"}],"_npmUser":{"name":"wushen42","email":"renaud.reguieg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-pubsub_2.1.0_1597820184255_0.5229121815145081"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-07T16:48:37.933Z","1.0.1":"2020-08-07T16:48:38.108Z","modified":"2022-05-12T00:03:01.485Z","1.0.2":"2020-08-07T19:11:51.021Z","1.1.0":"2020-08-07T19:42:37.720Z","2.0.0":"2020-08-10T07:43:01.992Z","2.1.0":"2020-08-19T06:56:24.401Z"},"maintainers":[{"name":"wushen42","email":"renaud.reguieg@gmail.com"}],"description":"Object matching publish/subscribe pattern.Don't bother with topics, subscribe to the data itself","homepage":"https://github.com/Wushen42/o-pubsub#readme","keywords":["pubsub","pattern","matching","eventbus"],"repository":{"type":"git","url":"git+https://github.com/Wushen42/o-pubsub.git"},"author":{"name":"Wushen42"},"bugs":{"url":"https://github.com/Wushen42/o-pubsub/issues"},"license":"ISC","readme":"# o-pubsub\nObject matching publish/subscribe pattern\n\nWhy bother defining routes and topics when you can subscribe to data?\n\nEasy to use pubsub mechanism using objects instead of strings \n\nas a standalone\n```javascript\nconst PubSub=require('o-pubsub').standalone;// import a standalone pub sub\nconst {publish,subscribe} = PubSub();//create a pubsub module\n\nconst unsubscribe=subscribe({hello:'there'},(data)=> console.log(data));//will log {hello:'there',meaning:{of:{life:42}}} only once\npublish({hello:'there',meaning:{of:{life:42}}});\npublish({hello:'you',meaning:{of:{life:42}}});\nunsubscribe();\npublish({hello:'there',meaning:{of:{life:42}}});\n```\nor as a web service\n\n```javascript\nconst OPubSub = require('o-pubsub');\nconst PubSubServer =OPubSub.restServer();//import the server without options\nconst PubSub=OPubsub.restClient;// import a pub sub Client\n\nconst next=()=>{\n  const {publish,subscribe} = PubSub();//create a pubsub module without parameters gives an example one\n  const unsubscribe=subscribe({hello:'there'},(data)=> console.log(data));//will log {hello:'there',meaning:{of:{life:42}}} only once\n  publish({hello:'there',meaning:{of:{life:42}}});\n  publish({hello:'you',meaning:{of:{life:42}}});\n  unsubscribe();\n  publish({hello:'there',meaning:{of:{life:42}}});\n}\n\nconst server = PubSubServer.listen(3000,next);\n\n```\n\nwildcards '*' and wild path '**' are implemented on subscriptions \n```javascript\n\nconst testWildPath=()=>{\n  const pubSub = require('o-pubsub').standalone();\n    let results = [];\n    const msg = { '*': {floor2:{floor3:'hello'}} };\n    const msg2 = { floor1: {'*':{floor3:'hello'}} };\n    const msg3 = { '*': {floor2:{'*':'hello'}} };\n    const msg4 = { '*': {'*':{'*':'hello'}} };\n    const errmsg = {'*':'hello'};\n    pubSub.subscribe(msg, data => {\n      results.push(data);\n    });\n    pubSub.subscribe(msg2, data => {\n      results.push(data);\n    });\n    pubSub.subscribe(msg3, data => {\n      results.push(data);\n    });\n    pubSub.subscribe(msg4, data => {\n      results.push(data);\n    });\n    pubSub.subscribe(errmsg, data => {\n      results.push(data);\n    });\n    pubSub.publish({floor1:{floor2:{floor3:'hello'}}});\n\n    setTimeout(() => {\n      console.log(results);// [{floor1:{floor2:{floor3:'hello'}}},{floor1:{floor2:{floor3:'hello'}}},{floor1:{floor2:{floor3:'hello'}}},{floor1:{floor2:{floor3:'hello'}}}];\n    }, 10);\n}\n\nconst testwildpath=()=>{\n    const pubSub = require('o-pubsub').standalone();\n    const msg = { '**':'hello'};\n    const errMsg = { '**':'NOPE'};\n    pubSub.subscribe(msg, console.log); //{floor1:{floor2:{floor3:'hello'}}}\n    pubSub.subscribe(errMsg, data => {\n      throw new Error('Should not be invoked');\n    });\n    \n    pubSub.publish({floor1:{floor2:{floor3:'hello'}}});\n}\n```\n\n### Constructors\n|Name|Comment|Options|\n| ------------- | ------------- | ------------- |\n|standalone({options})| returns publish and subscribe methods| options:{<br> matcher:(candidate,pattern)=>return boolean<br>}|\n|restServer({options})| returns Express.js server| options:{<br> matcher:(candidate,pattern)=>return boolean<br>}|\n|restClient({options}) |returns publish and subscribe methods, options are http requests one.| default{<br> hostname: 'localhost',<br>    port: 3000,<br>    path: '/o-pubsub/',<br>    method: 'GET',<br>    headers: {<br>      'Content-Type': 'application/json'<br>    }<br>}|\n\nCreate your own matcher and pass it as a parameters, candidate and pattern can be anything.\n\n### Methods\n|Name | Comment|\n| ------------- | ------------- |\n|publish(data)| send data to every pattern subscribers.|\n|unsubscribe=subscribe(pattern,callback)| subscribe to the pattern, return the unsubscribe method. as it's a FireAndForget, ensure to store this method.|\n|unsubscribe()|unsubscribe to pattern.|\n\n### API\n\nrestClient is a wrapper for restServer but you could implement it on your own:\n\n| Name | Comment |\n| --------------------------- | ------------- |\n| get('/o-pubsub/') | returns 'o-pubsub is online'.|\n| post('/o-pubsub/') | will publish req.body.|\n| put('/o-pubsub/:id') | will subscribe to req.body, ensure to store id for unsubscription.|\n| delete('/o-pubsub/:id') | unsubscribe to pattern registered with given id.|\n\npublish and subscribe accept Object,number,regexp,string,Array \nnote: on array the comparison is made first on type then on length, not on data inside.\n","readmeFilename":"README.md"}