{"_id":"safety-match","_rev":"13-099c341f063066f580db9398456bb60d","name":"safety-match","dist-tags":{"latest":"0.4.4"},"versions":{"0.1.0":{"name":"safety-match","version":"0.1.0","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"8e9dc7c29fbd9686f125560a1477901ccbac93ed","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.1.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-A5Ry7TXxRgu99SQ9uojO4EklEx/CUVe7+m3IiN/isk6oOhfX+FwuViaEJ0f0kERgLngqJsI/lmwGykbJOtG4eQ==","shasum":"2c149fb53410f6e71be30c4576bf8beb49fa22e8","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.1.0.tgz","fileCount":5,"unpackedSize":7069,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoFiNCRA9TVsSAnZWagAAvlQP/iXhbDVNqj1YkakT3IST\nDSIhoTgMnYU6HKygkh8TaBbStC5ReD7+kgzkjSKdzP0oByEnwjQ5TUXtLIP8\nrW38OgahFuul6kUCD2VJ753wuCEkHmx29MWx1imnokBl+jVyo5no5a5kNPMF\nMhsI62bn/QY9UFa7iaaUe4Eo5re7lxOuWPNV4+tPiR4862MizCZsN+xxa+qo\ndxkKlnFl9a0yW702aCHFqFCXlu7Ly/s8alQcVg9pKYfMAYg4vfoEQAXnxMng\nWX6jIw1wDNwSi7P6E0hfmjKfEArpBf74PUeNCFhG3MchvycbXgsDc3SsXujE\nvWkgzSra69sT3X9uEpJG+1YcEaV6KC45CZbhu+bhX2wfiWiMCB4V1a5Grgsi\n8BGOY3J0HY10kmf9AnUkPAdVUdFel68FxgQMeob+ABQlxHCLybFYhJfiDeCs\nZBkj/RNMOxFuChfRIWJikGcDcSdK6F8XvlRZoNKedAWSfbLUIzCdQxAxoEqR\npuqoKemx/zfyNRVCAkp7029niYS/UG2qgW7P1Ww5X4IZCMI22WHeud9a6ZBt\nm6yJk9pHX0FlLhdGps4TVG+bqG3JBzvbjRwxoAvnicVH/92Bi5sGl6PmTTal\nI0bl4UNqyT0lXk0rxf/EM53W6qQ4qnaVNu4C3dgjb3yhH2K2z0c50bdryBkx\n3MJ2\r\n=pbfQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG9zciPjsHcJ4sc9KCD3ceFpPr5YlG7M6T5jui17xO0sAiEA3lx9YdZ96H7l1+1aZD6hhICnfkEaeIt3VqCwFZe6X3I="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.1.0_1570789517099_0.6192365273258644"},"_hasShrinkwrap":false},"0.1.1":{"name":"safety-match","version":"0.1.1","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"652d2c3d6a39fc41babc5003f90d415ec0fe55e4","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.1.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-7s0YXMHrb/R1Ot5hOVO5S7Ds2C6BFYV87MjrYhVgtUoX5iHW9MwddAYn1aLdDV6gkXxEfF3xrpJa8OajkAyy8w==","shasum":"9f710f88f24d88fe44b021497609cf36c1bfa0f8","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.1.1.tgz","fileCount":5,"unpackedSize":7071,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoFlUCRA9TVsSAnZWagAAVhsP/2N+A2UXR3oUCZfgtlS8\nLng16gdm3f68uYkCHDem1k+P9LSR4LLqWr8svg0+Z/aUbbcREFdhyqyWTsjy\nJs2tQv4HWto3pNubYOnrNYrcUgH++sdft7PBLZKVpBvuzQ3j0phQnDM4Tvl1\ngz04m8z1dwx2YnC45bhROx8qIlqNKEvIluCi0qznEnHZazNfYRret8kh9D4u\nvsNYvSXOpUsosT9X7Qj6U2+r1etjSU+VT3B0LmNi+zHXUXxCaoIihG+oVFgH\nVt75jXhm4i3kerPHZbCVlUsAt8mlcGaqz/ffpCqKAwiiWH5NBbQLbSRcLpZs\n/UPkc9yeQvIK/q/LGSCDgj2FBP2EeidIA1oHjMhiG7voCYxYs6mt7RbcTesB\n36sFOpqSoyKox0fM8iyf7UjKBsgdk+EBq7IsoLH8GRVw+HYdDGgszSQlFsQy\ncZoEO+a0kMqgJLq/BHQi0pibkocfnBXzRnp2BeDHdDmOHrDprMAwcrx4TlTI\nP/5KeAev3cXmv4POgyKXsyhg8C4r4nY4iaiBSGKXAei2b04zUKy6DAd7ffUR\nkDMlOAX/RbC6jBtviBX+rOL9/+GFnxk5C5WeEA2UYDWpX/7AXMDR2SfWvbcN\no53XQK/84LFpOqD1e9oaC7q+PMgeooadIOjZEHwF4msHfsjyji5gX6Bm5HR5\n7T4i\r\n=XLnk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFH8fOmF/l1VCikKY8DBIU4lmFbNA6WhXLW+EzhstQT/AiBjGwdNP7t3XuV5QM7qZIUOPl91MLTEaOft/342Epp69g=="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.1.1_1570789715857_0.987010983757391"},"_hasShrinkwrap":false},"0.2.0":{"name":"safety-match","version":"0.2.0","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"7990bc968848871191d152bd77d40cefe62a4e7b","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.2.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-uvCD7YQv7hN5KjtRnmXsB2YiXgC47FtLSthDGdcRrD9Kr4XZQsooCpKRdOQZwrIBE8Bs93wA+7YJHrcfGnLsXw==","shasum":"cd180401b972e23a68d02c02de1ae6186a86c137","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.2.0.tgz","fileCount":5,"unpackedSize":7538,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeIaL5CRA9TVsSAnZWagAAGowQAITIOY20VPUWyW2PI0aa\nThmi9HRUm+Z/5Rr4PPVtZx6YQgJhrzV/lHryYSzpn53d1dhBNXw1EUdF9W7R\n3AdWVnD5yMkDxHrfRw5gF/3JtHt83Yw257wuszb1YxiT36VEBzkpzZyNE0Xg\nSVHK6IwGfPcnsjirFrA5kvBh1L1GL6GaCmBjFVQT/r17BCL6zsIhw6rfNuY+\n3XjT0IC5wNiI7ZOAKQxLj/GHHkhSwLWRK0CNPm/FAlvkigPJnO8JU/oBzCx3\nOi1ycqvy3z/WGXcCrpruZ24rcRme5FWgK84eCTNOHmsnbRNoLiAKJuNzxLpC\nIzz879xmAhqEwOtD6q7xughv3qmnzv3AHb51R1sb3F5R980TXYFOgmghs3Wr\nIC82B1AiDzkAJUHTqxSG5fL989uWvjugujJHNXQ1gwX3LFfFEm8b1l65h6KX\nPpC9I42EW3NpdhueMAQdYChZeHG3+OrDg4CVqICaWSFUWC82CjAbAv8/wFDJ\nPa8uGqxCjrhzLGhpgbD7pK0ikoZ5fzTghEbQxoQC2yrUq/Q3+eJwViqTU+YG\n9V1UUY4v7dX/JG0tE+nJtSPi7bk+OmxVrqK4bALS+QoPIeLRzpP220s8VVpw\nAnW9Z6tZSpen23+2nEE/OgD/RoVWtPHg0PEhxEc9C2pmLTKfvni2b80j+TT1\nELtV\r\n=gJP8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGK1JOu1nxSStjZXLdnINj1RbosCu+0xMTftqwQCZOyiAiBd1VvFImTIiURmXEezFki+BnTcvGgiYa5UMBCYHSjrjQ=="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.2.0_1579262713129_0.8844418898852779"},"_hasShrinkwrap":false},"0.3.0":{"name":"safety-match","version":"0.3.0","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"e2aee73094699e011052685c5132a4a15cfe56b1","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.3.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-W6WygANSQl+FSEwyxzZkKnmZYaJmu2+YYLqWc1lEI8SKz/zKazwtrXoAbDo6xqBSq0XfU/YW1HEOnjNEQM0fDA==","shasum":"df357901c27aee99d694c2ef91981d9894c3d5ca","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.3.0.tgz","fileCount":5,"unpackedSize":7293,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeIcNTCRA9TVsSAnZWagAAt0QP/A1xeJjZRw8hK2tXL/HU\nCVUfKflyfXRa5O9OdWhkR0HebbPNZTjLt6jZfYt0am3/KGtzEl98HWlwiSmC\nymlcnr3yHBEfogBXOiyAzUxjLkcPVFKeXT52+gOnac0NShXf8uOdrTlSa4Nc\nPYbPfcwp6VIb8lJSFDKU1zT1vHsdxV6k9382rV8geZh6ywZTTIyWwAWrHXFH\n/WEO/G8gCpITGziPwzAuHiGlu6uboc+Zbb1Qalopg5XTXCi8XXEt87/V0e1S\nq+9rUW7N5miNcnBtEbctGaymXhLe3Tvz+VGW+5Aqez0h8V2C6/ey0macDBii\nHy/kkhAsCRJP6Y6dv950QqPArCwCh+NAyejxXDyxbK70MqHwrY7nF7vaWJj3\n4R5Cry0AJONiUPHIrfDmevdbNnhqRCqPeKkZEkp5vsLHi31Xov44WDJudwup\nkTpNAfiCSPt283kwxtmiJdRAATBSXJK0WRAOfKHz4RVHI3TJ4wC4tPGPD1/4\nGu/ZHh+SuXASXsXuLvJt2ocGU72s5hG5507Bi9pfKQTy0edNoyn/HaJDpQHi\nFJBXtcV27kmBjb/36jSzlm3ccf9rBwak+KFpFlkmqJ83e75cfcDYcNcSbeeS\n99Om1rZrpyB7TE4s7LXjhhNgPty5arGjfu6fFCcN3xxIZOCiCf9L0B7lbgYw\nUPTq\r\n=omm+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGIFv6qHLGghhztGdDShtNmDXeYx2/X0/60pg9ajx0S8AiB98kGFfdSx3D5apmTHX/UJy0+4EAnQjyoGWPvYEMxbEA=="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.3.0_1579270994812_0.7646785639388605"},"_hasShrinkwrap":false},"0.3.1":{"name":"safety-match","version":"0.3.1","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"e31abacabd62f3152d9110f7dfb66a6672bde0ac","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.3.1","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-1oGXgMqbCsaV2kmDdFRDFSgZvS4OQ5zidyqcEc5tdogUflMDk9mVeimWxl3DT+yXYVcNnkQWRiBViMg7ucGxBQ==","shasum":"964ba13e2a0ac998b092924f9e5ce59976802b5d","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.3.1.tgz","fileCount":5,"unpackedSize":7185,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYC6+CRA9TVsSAnZWagAA7GgQAI5/wQpAGMcIGjf7qvhC\nDRYjACf+uMCECcxVy8vkqPaaavWjg9OYwxXZNT/FVJVMz7/yCS7IKqUMQumJ\nplVMcIkv7Up9caleIZgJrgWA110DgvTL14QPaOQOPnqhv59oeTkqau+38aPV\nrE6xYaZ9ZT0nQUkBI8O7n/sNm9lEwke/rYkRNSYcDpekApvrdmECenCevSkF\nj0am79OwgB7o2karUY7Va4lkM/Cp1PgoEINcckY5xgpi2wMvNpjJGPrAqI4G\nI9cfcyepMZlXg52ae7NtKnEuH4FwufGbSIT/3k8fRGngOWdlhxR8/JK++mvh\n9uDwkl5B7VgC8b9mjayuYF657eOmc1KJYwgeYQiBXP4rrygiF1OaqwrOjlvJ\n8ig1dbhjTc6AHvjM6EgDdhn47DjY8Jk7CeRxciuKK8sBF1IHeVjH/318A7BI\ngfs7pSeShWpTUbGbPfn4+jZ6LtiXJx7Falx3Ui1V+c4WLIvwKRxMBMeot2hv\n3OvaRUCcFRErGx7Sb+G/UYBEMo9+Xf8bPzwP9gGkYJMPbF4b8vQHJO8iD6uM\ntZRKyZuZKvHC77/pmOFUNxP+sUnj6eeNXln5SdMeUyK+SWTT1HMnJ17w/gfW\n4+fRj3IZSuyk67QkVydjdXCU785RpwZ1NOAJTv0ScpxIi/CthR2mfLN3pTDg\nrlkh\r\n=H/Zp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmshjgmzDv8z3BsZBkgVBL42wDVk3LoUeZ3sQiRm0VWgIgFxvia1USb+i66iCN5+qU4dWOyWMWeAlvWgZwRKNMw+o="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.3.1_1583361725654_0.3136741762061048"},"_hasShrinkwrap":false},"0.3.2":{"name":"safety-match","version":"0.3.2","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"e31abacabd62f3152d9110f7dfb66a6672bde0ac","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.3.2","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-ST6Om0PvMiHOp4vxyTxl0PTzsk2UIpy2J1kPpqff3W+bo1rOK7U2Kqj6hfC+LAI33FpxbgQrqPitoflPL6sMYQ==","shasum":"691761e4f48ae91c18912bce5737ea157b3c6497","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.3.2.tgz","fileCount":5,"unpackedSize":7079,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYDD/CRA9TVsSAnZWagAA+zQP/0L82yvYDtH9vJ1EfvN4\n9Qn9A5zSQ9S10M2/ZzK33XPyl28JNrzfumfBGgbFkMZ034TLHTmn+CnRn9kf\nTl5LcmWJFYl+9UBgC3OwasT4JH7/gh3yS4Yn21XwYzUPS0oslYjf7RZWVmtf\njKkwBQxd4Fiy10/6yZUpSnfKOm1xvkDn+zPrCZT+glOLAcplGYsQ+38/ROb0\nGMVLBq2yEU+Yvlqkt8sIMeQlrFbr7kO87X4zutjJMUgBsblLuIsDotMaCntM\nA6PlhLwLa4JLJn61+hQU0DX2cocfwjxcVSz2/7Ty/UaS/Yt0KtZwVpwfuznT\nLJ/wORnP9ecUSjLl/k/UVdz8rcYgCBLM9DfaxQ6fh4Gx98mdwxzIBnVvS/k4\nVw7+XsQyO9NUylr/A1NMix4oYfgJ1aZbdt7wF/tRrPEaBdCDrlzszDY+F5p+\nRPAJuhURZYaY5yzzkn3x/Wsc+Kt0kSX53LIA2g9wz6lD1Q6UjShk7VAkV5SR\nQDVn1S8dVqBWNTu5n6vhQk7VTHW6M7XnLNXxskdUptdBUTirwRrjRQBaw47S\n9saZOI48jlDdYBt8cFs03cHPTI1vPtuE5t5WLEe0SF2YYq64lAqS7BPNoRFn\njEmE6o3SC+8fokUSH3mPWSCxT2XJk+LPXdoZ52Ga4EVj90ZrTGMIlJvWdwnY\n8L9G\r\n=K1ol\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAv72FuJBnkO4wA3b0TuzeiCE5dckwqjPODq0Denuzz8AiEAnPgm6G4NdThH9A1Jom3OurotQjg8VgxhQvCNHVJli7o="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.3.2_1583362302995_0.10876930714733124"},"_hasShrinkwrap":false},"0.3.3":{"name":"safety-match","version":"0.3.3","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js","test":"jest"},"gitHead":"ab1c4446cfc844026f8db1a2a7f1b87288b89f3e","description":"`safety-match` provides Rust-style tagged union matching for JavaScript, with TypeScript types.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.3.3","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-0tmBm+e9PqMBgM0VwGrFiAbhRron0Q9fGDH6hyV0Jt3Jdx/q9Pr5SDye/AIUf0Z3VUYqgfNoRb+/hXDPbgElww==","shasum":"2b71375f1522fbd7966451bbc4ac2d2b80774197","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.3.3.tgz","fileCount":5,"unpackedSize":7162,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJefTKiCRA9TVsSAnZWagAABtIP/3vhXSTQHo/8RdgeGrlP\np+LgByZVebdEo2M5u2mFTWtCiweMRv04KlRlsiV7Y7QGiKcW8YkFB4s4H7jp\ndHCPwXzZ6ye3mnAsa3qMt2gKX2NkyLL7udAFViLv9g2d53LWT5wjaGJShtc/\njCzCEbAcwbDCn6+6Tk6TIWI2aJRq9bJ1XeZY5pTzp75bDvhKVON7wtQH2xO9\nlFYkEBSvHnjGnSjLdsVjyH67Zk1gvnnaDg+/kO0rx5sR5vhMp9di/RqfgVCL\nri7woJ9GC+c4p97RoIPWwKqxoEi32byZ8ZbvhDSg0K9pWd2jSsr6FPIicXIe\nJpSBG/7ag9nDVK150ICxvp30VtUYEb+jqPGOz85Xtgx/lJL0rlp0VJgdxWoT\naCoGoT+wiR+rMHOLtMxiDHxejqYcwmYf2PcxYiHARDUohhaFrqJdU91ijpdY\nig+Rw9Mhn0HRIJoyAUTxpFlf+TdEvMXzI6UxuPR+6txiUB1qOYN9Ikz5pkQq\nwafSrlqOWzCvqZlqiU0Ilrm/F8/nkh7qRNyCV6QmLIavEMa6XR181X2Cv2De\nOWiUkz/rW7t3AqbJ8rHvXRRk9RNeDRNXg32QtAHSM55BWgu8tBnaMn/TVIwB\nZaJ3fDjmj4OykM4LhChg2QwzjD33/GynQEwgoFwOsL65iUq1GKPwiQ7oSB5m\nPuhW\r\n=eZX+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICXYDCR3mGKeVLI+t101t9sa2o6BisCzpY+KdCKoA+SUAiAWe1KKytGxjbTXzR34WFDPG0MvfJCaBcgBZU0ym1l9XA=="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.3.3_1585263265834_0.34232198908083045"},"_hasShrinkwrap":false},"0.4.0":{"name":"safety-match","version":"0.4.0","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","typescript","flow","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","flow-bin":"^0.134.0","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js && cp src/index.js.flow dist/index.js.flow","test":"jest"},"dependencies":{"flown":"^0.3.1"},"gitHead":"135a404cf87d4bdf4c754d0dc54eefccee6e7f21","description":"`safety-match` provides pattern matching for JavaScript, TypeScript, and Flow.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.4.0","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-POUy4DXgTNRFmyYFDq7KEcGyXXLa95Y5rb/1firdIEjZl8Wgy877pwT/50h+IGqTPQu1ADwbgx5IHSqA9CWsuQ==","shasum":"081d1a3cf6c5319079aeba6040ea322bde8b9a4c","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.4.0.tgz","fileCount":7,"unpackedSize":25220,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbVunCRA9TVsSAnZWagAAn9oP/3YstiDtRS/YFfJxhIzs\ngK4ZaltcTW9umZeuODggAXoW99PHUU14+TFT5AprXHgZy3OFze+KvbGcaUJ0\nMG5FqOvVPNhfp0xcCOV7CGQNME4HC4AOrkxZbtVZwGB1t7usvtZExvkysXBa\nGJUMF2SXBxJmIVqUkfUI/VOlbaLY0KZAwhDNwT8fGGkRZz9vmm1P78xVeGR+\nyl4p1q+PYkDBpOF1iRdwLjwBtgm1ZZSGoZewZiSUyz0k48ker4Ug53BwFf7P\nj54T56t3inE0Hevj77yA30RjCQieQMrqwOwjvfqSaBJWU76Y7daACUV4Fy90\n15dyxC/XVKUykTXgv5AX+z4mnQ7M+aJtw+1N2GA/6Q2etfRQCoTItQ+FQ9zw\nbqDbxRzsX+drVwaQXTNeOktPGDDxzN98E9aLpF/YyAXKzFBLlrIlpiKaMYOS\nZCWP8vJp1G/7KsKuhnlx6/eaqFB2bAFFHEDIvxA9z5ozG6Hl/gAFRrUv7Gif\nhT8GQJoonyZlFt6JnJ0E7XUcqCTKlzV/9e0tKJGDHicxcwCXMjyFC/fx4BSJ\nOyeGD/AcymLh4wF/SOJSSfqhOKpRTrC0aJgbnqITXgHA6KCyCIBeLKuspyco\ntw8CWFVFNVGmCXt3DsFLvvAEPXgbixibz50RiF8wKB/HaajD2CVWYVn88UqV\nZ7Bn\r\n=cnJ0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCf/t/cN0gYjkSSdHwXxpRNsRg/PAHkt2BZtgh+Aim+OAIhAOi6ieLaYjRjxG7rEzHOuXOWEYl14TigM+m8UqDg7v/3"}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.4.0_1601002406520_0.9095408482927809"},"_hasShrinkwrap":false},"0.4.2":{"name":"safety-match","version":"0.4.2","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","typescript","flow","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","flow-bin":"^0.134.0","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js && cp src/index.js.flow dist/index.js.flow","test":"jest"},"dependencies":{"flown":"^0.3.1"},"gitHead":"3531b1e3919810ea65a37b3a0524e6434c73dbec","description":"`safety-match` provides pattern matching for JavaScript, TypeScript, and Flow.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.4.2","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-cO8cV+hKs4AdcR0Lds6pZhKvafc/odLEkU7ntkG4/YjlGytNMtnOjpTXJgroGXqididMFfbo6wfW6nv5OugtlA==","shasum":"53f5dc5bc137bc92d364990705e54b7abc02a7ca","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.4.2.tgz","fileCount":7,"unpackedSize":26576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbaQeCRA9TVsSAnZWagAAQcYP/17M+lvSdCKp1cy9FO0l\n9oBnmk+Wg9u0HZ7xc3rcQuWnAEEVpVdVRlLg2S8i2Ez6l+GpbiiHx3ta/UHE\ncJats5tRTEqjsM9x2U4PpF3h+uxxLNntWXlvZWH3c0Glljl8cxWG357+dkwV\nwEDn5inWgtv/YaZ6EswmxglhJm5vZTMtzJ95QVuMrwvMABNLDkx0cHhcb5d8\nuR9i2c/5D7hGQUEJ0AaKJwW6UrbXcnH3unYzSNXStUrmZBHr0qTqjev2h+Ph\nLPheRvaOs3n5NTpcaL2VylJhVOB7wartcqEe49yEZ0vcnQs9PJeiDEMGDRhb\nG1In97IdchlLK87mjsL+XUjOTZcpRwEjblQyAm5KOo0A5xu+0iN2RUvBF0Cq\nkggZqA0z7htPKkEU1EsT7VTDagJjKVMg6Q+cr2KbuNrXjQYZKuS2Ffj7fgAc\nUeirAQG31shN8Tly2l1T2iDKM7SEvZqNpolq2+ggAKTY/PG3oceEJPFtWJya\nQetHJqgbc4/5oWNroeDk9MyjrpJAAHmfpN4UcWD7dB5rCSF3oI2IZzJn/7YM\nCLAXJSd4CtbV3EjuZbrxqIKoH4M+QICzzP25uUAs8EHyXbkhxv089EHSLJgz\nD5GPg0GfyPa/T7EyRyF3Yzvp11YFZ76MAdF93VEGnVF6RNYLgeTk4QB10kHQ\niO7i\r\n=1nS1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICJwYGIeBgw05PnSZ0oqG3nbQNf1ezPma/ZiBqEoxTFzAiB65lgY9EhyoUdMbdJYdua/wxCfy5sG+8AUTOGHl6AxAQ=="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.4.2_1601020958120_0.15939998548518108"},"_hasShrinkwrap":false},"0.4.3":{"name":"safety-match","version":"0.4.3","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","typescript","flow","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","flow-bin":"^0.134.0","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js && cp src/index.js.flow dist/index.js.flow","test":"jest"},"gitHead":"8b8ea0e505038cf3b0628a8103fdc89cf1ac0a0a","description":"`safety-match` provides pattern matching for JavaScript, TypeScript, and Flow.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.4.3","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-J4HlL0Zy65TZY2iRR6R2l16Qz8QwxQh5BCoeK254TzHNaT1xAfihJQUVqxTba1ZwPwab64ghC9CVKp/4eCjRTA==","shasum":"4046de75ab42ecde1d88a465e2b26b29d039d601","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.4.3.tgz","fileCount":7,"unpackedSize":27278,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbal/CRA9TVsSAnZWagAAxkIP/1N07xATiWvjSPNomQuR\na2RdMZhWjG0mjd7wAHvMfMOENl3Yib7nvcoLwTk5Pi80+MS8c8zHoGW1qjXP\nZnjE8WKGofOfoAzRsfTfwFqnxOnYoOU3Rdz8lotKufUIBdzonyTnP1SsMvi2\n+E94pvQb5UA1D6ec1yj5lC4q6TjD123Z0tKMa7Zv8HRAq0w43IxmZTdPZusy\nNA7kI8lL6mLuxC3zAJyV0AyTP6Dm5g+g2DFM1q5A/9lFfI6a3ATfwV0zYXYk\nDfx15/rbFFrMNKX8Pa7ZIpSBKPcBjPV01owp34v34pEcKsWayezSQ56JFcte\nNNRFQHZCBy/ylLSzRPV3M0ZirwfS61qTzgw5jSMZkO5/o4TntiodcNsbZ4QD\n1ljolum4/QFUq/5jasq7U5OmPRbo1wuRIfDPdvn2Az5dCY/gQdyxMo+8keUT\n5VgBq79bKuzk0bgsL9AEIj9NVFNi6tnlDmxm1VhmWk7akf4nh1loOo0Rh2FT\niJ6c/cQcHeWUTiNYAumn413bWMWNWlLmb03Jmp5feN2wdAPm8Htf2FKj/dbG\nIBtgK8j4XcHBnxaUJiNeG1FGyV1Yv9u5vfWw4De3InEZ21NrthOo0QPqtmMX\neiiMnHZnauhNFuHEge6iccKDFihFkn//1PFM73vOZnJm58yMvXuAsTQYCpqP\nw99t\r\n=74JY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCluoNlskmFVQvm7rX4Vo5nSlu/WtYjpg2VCC4XbapsBQIgameJURMLGizKcx5c0gz+HWqNzVGPhSyNk2IL1Ieqq64="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.4.3_1601022334912_0.8674208212403214"},"_hasShrinkwrap":false},"0.4.4":{"name":"safety-match","version":"0.4.4","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"keywords":["pattern","match","matching","typescript","flow","rust","enum","tagged","union","state","machine"],"devDependencies":{"@types/jest":"^24.0.18","flow-bin":"^0.134.0","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"scripts":{"build":"rm -rf dist && tsc && cp src/index.ts dist/index.ts && rm dist/index.test.js && cp src/index.js.flow dist/index.js.flow","test":"jest"},"gitHead":"2c69c955e205db93bf03a69d1554aae195cc7f10","description":"`safety-match` provides pattern matching for JavaScript, TypeScript, and Flow.","bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"homepage":"https://github.com/suchipi/safety-match#readme","_id":"safety-match@0.4.4","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-f6+n7M03SGjmL2d3/nf/tsXyjw1ATQ3n6JPGqk5NRxvqmWHIG03deeVLrjy72mzLyVTp2k7WF3NrbmdrG/IKdw==","shasum":"58e8fda404bbdf3116c47300dbe2900490b38b63","tarball":"https://registry.npmjs.org/safety-match/-/safety-match-0.4.4.tgz","fileCount":6,"unpackedSize":27347,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbatACRA9TVsSAnZWagAAljYP/AjI33MAUVyBdpCpWujN\nGijNYPWn+9NEFW7U9z3lmZC5jvOG47DkrAfugjECaGULoILJrEFfBKxivMUo\nDq94PrdKmPFweuWTZ6LebwGcSjqLtaR0a0f6OBqMbi3scvlB88dpJWJi+bau\nbUhdS1y86gwsN3CG20I+r6M4lK50FYLdul6Y1jJA4RYeYZZCopLAJV0bA4Zb\n0yBK4+jDUX2OYZxWklXOxYzRpI6UcqDSz0gfPoFaoD2hHMiRomriVv5RNw1v\n+h4vCGYjX5s6pXZ9aN9af4sFrcv7uVRs91aMFsFmzv/pDI26CT4WaNEZOy7v\nYFVRNvvuohscqiutObSmYAxYnNC48EcnoGvn/QgKVcXRXJwGyKT20IhFyNI3\ne1aaIhylXhtabgf2rctdwlsagOEvuVCfaqvyNdbxwG3liBq4Wx6S+cz4zjmr\nFftL4FHCO95OwoZwcP7Ac2Pw4/v86AkfPEnei42xvtFLdi5f0xKdftmEXDOl\n7BITbcO8noBkFrDH0fHYEZyS3RllpcJrbgPdD1pnvzHvC4XDwQfdPaHFRzrj\nJPJfEvF1oXdjG1KxY4MjkcMQZa6/wk6+Ol85qLf7s89J5DB/RKfX6IutjOVf\ntt3o6ipA8SyLU/2wbRFy3XSBHmsA17XKFh4/wHpcO6Eh86U3KDiGZW/Gr/JA\n9mxh\r\n=v1d1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8F47auCUih8/dwL98oiS45N6YmsIfPfoY4DXEl9ew5QIgDqHhNaYFDDf7VivywsHHW8ADwWgJ/Hb3gCS+snqQtvc="}]},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"_npmUser":{"name":"suchipi","email":"me@suchipi.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safety-match_0.4.4_1601022783670_0.7529739876639134"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-11T10:25:16.868Z","0.1.0":"2019-10-11T10:25:17.275Z","modified":"2022-05-16T10:24:59.119Z","0.1.1":"2019-10-11T10:28:35.955Z","0.2.0":"2020-01-17T12:05:13.234Z","0.3.0":"2020-01-17T14:23:14.972Z","0.3.1":"2020-03-04T22:42:05.777Z","0.3.2":"2020-03-04T22:51:43.101Z","0.3.3":"2020-03-26T22:54:25.928Z","0.4.0":"2020-09-25T02:53:26.657Z","0.4.1":"2020-09-25T07:50:23.310Z","0.4.2":"2020-09-25T08:02:38.343Z","0.4.3":"2020-09-25T08:25:35.070Z","0.4.4":"2020-09-25T08:33:03.919Z"},"maintainers":[{"name":"suchipi","email":"me@suchipi.com"}],"description":"`safety-match` provides pattern matching for JavaScript, TypeScript, and Flow.","homepage":"https://github.com/suchipi/safety-match#readme","keywords":["pattern","match","matching","typescript","flow","rust","enum","tagged","union","state","machine"],"repository":{"type":"git","url":"git+https://github.com/suchipi/safety-match.git"},"author":{"name":"Lily Scott","email":"me@suchipi.com"},"bugs":{"url":"https://github.com/suchipi/safety-match/issues"},"readme":"# safety-match\n\n`safety-match` provides pattern matching for JavaScript, TypeScript, and Flow.\n\n> Flow support is a work in progress and may not work for you. It's highly recommended to use TypeScript instead, if you can.\n\n## Why?\n\nThe point of `safety-match` is that I wanted to bring [Rust's experience of pattern-matching on enums](https://doc.rust-lang.org/1.1.0/book/match.html#matching-on-enums) to JavaScript.\n\nLet me explain that experience a bit.\n\nEnums in Rust are types that describe different \"variants\" that live in the same type. So, you might want an enum that holds \"off\", and \"on\". Or an enum that holds \"loading\", \"loaded\", and \"error\". Any time you have a value that can take on one of several distinct states, you can model it with an enum.\n\nWhen you define an enum in Rust, you use syntax like this:\n\n```rs\nenum Message {\n  Quit,\n  ChangeColor(i32, i32, i32),\n  Write(String),\n}\n```\n\nThe first line defines the name of the enum; in this case, `Message`.\n\nEvery line inside of the curly braces (`{}`) defines a variant of the enum.\n\nSome of the variants can hold additional data inside them (in this case for example, `Write` holds a `String`), but some don't hold any extra data (like `Quit` in this case).\n\nOnce you have made an enum, you can use it like a type, and match over instances of it:\n\n```rs\n// Given msg is an instance of the Message enum\nmatch msg {\n  Message::Quit => quit(),\n  Message::ChangeColor(r, g, b) => change_color(r, g, b),\n  Message::Write(s) => println!(\"{}\", s),\n};\n```\n\nOn the first line, we use the `match` keyword to do a pattern match. `match` takes an expression and then branches based on its value.\n\nThen inside the curly braces (`{}`), each line tells the program what to do if the variant on the left side of the `=>` matches the one in `msg`.\n\nYou could also use `_` inside the curly braces to mean \"and if it's any variant not listed here\":\n\n```rs\n// Given msg is an instance of the Message enum\nmatch msg {\n  Message::Quit => quit(),\n  // This _ would get used for ChangeColor or Write, or any other variants added to the enum in the future.\n  _ => println!(\"Not quitting!\"),\n};\n```\n\nAt first glance, it looks similar to a `switch` statement in JavaScript; you could imitate it using a switch statement by doing something like this:\n\n```ts\ntype Message =\n  | { variant: \"Quit\" }\n  | { variant: \"ChangeColor\", r: number, g: number, b: number }\n  | { variant: \"Write\", s: string };\n\nconst msg = /* get a Message from somewhere */;\n\nswitch(msg.variant) {\n  case \"Quit\": {\n    quit();\n    break;\n  }\n  case \"ChangeColor\": {\n    change_color(msg.r, msg.g, msg.b);\n    break;\n  }\n  case \"Write\": {\n    console.log(msg.s);\n    break;\n  }\n}\n```\n\nBut `match` is more powerful for several reasons:\n\n- If you don't handle all the variants, the compiler will warn you that you forgot some\n- You have to remember to put a `break` in every case, otherwise the code execution will fall through.\n- `switch` is a statement, not an expression, so if you want to create a value based on a switch statement, you can't just do `const something = switch(...) {...}`. You have to instead declare an empty variable, and then fill it in in every case.\n\nOnce you have gotten used to programming using `match`, it's hard to go back. `switch` or `if/else` feels clunky, and all the nice warnings your compiler gave you to help you aren't there anymore.\n\nSo, I built `safety-match` to bring this experience to JavaScript, by leveraging TypeScript/Flow.\n\nHere's what it looks like. Note that instead of using the word \"enum\" like in Rust, I opted to instead call them [\"Tagged Unions\"](https://en.wikipedia.org/wiki/Tagged_union), because TypeScript already has a concept of \"enums\", and I didn't want to confuse people.\n\n```ts\nimport {makeTaggedUnion, none} from \"safety-match\";\n\nconst Message = makeTaggedUnion({\n  Quit: none,\n  ChangeColor: (r: number, g: number, b: number) => ({ r, g, b }),\n  Write: (output: string) => output,\n};\n\nconst msg = Message.Quit;\n// Or:\nconst msg = Message.ChangeColor(127, 255, 0);\n// Or:\nconst msg = Message.Write(\"Hello\");\n\n// But whichever you do, once you have a message:\nmsg.match({\n  Quit: () => quit(),\n  ChangeColor: ({r, g, b}) => change_color(r, g, b),\n  Write: (output) => console.log(output),\n});\n```\n\nIt's not quite as succinct, since we're limited to JavaScript's syntax, but hopefully you can see the similarity to Rust's `enum` and `match`.\n\nMy solution provides the same advantages over switch statements that I mentioned earlier:\n\n- If you don't handle all the variants, either TypeScript or Flow will warn you that you forgot some (depending on which you use)\n- You don't have to put `break`s in\n- `msg.match(...)` is an expression, and it evaluates to the return value of each match handler.\n\nI'll explain everything that's going on in the \"Usage and Explanation\" section below.\n\n## Usage and Explanation\n\n> If you have not already read the \"Why?\" section, I highly recommend you do so. It explains some concepts and background knowledge that are necessary to understand why we're going through all this trouble.\n\nTo use `safety-match`, first you import two things from it: `makeTaggedUnion` and `none`:\n\n```ts\nimport { makeTaggedUnion, none } from \"safety-match\";\n```\n\n`makeTaggedUnion` is a function that:\n\n- You call with an object whose property values are either functions or `none`. We call this object you pass in a `DefinitionObject`,\n- Returns a new object to you. We call this object that gets returned a `TaggedUnion`.\n\nYou can visualize it like this:\n\n<!-- prettier-ignore -->\n```ts\ntype DefinitionObject = { [key: string]: Function | typeof none };\ntype TaggedUnion = {/* We'll explain what's in this object below! */};\n\nmakeTaggedUnion = (defObj: DefinitionObject) => TaggedUnion;\n```\n\n> Each property key on a `DefinitionObject` is called a \"Variant\".\n\nThe properties on the `TaggedUnion` depend on the properties that were present on the `DefinitionObject` you passed in.\n\nThe key of each property matches the key of the property on the `DefinitionObject`, so if you passed in a `DefinitionObject` with two properties on it, then you would get a `TaggedUnion` with two properties on it:\n\n```ts\nimport { makeTaggedUnion, none } from \"safety-match\";\n\nconst myTaggedUnion = makeTaggedUnion({ on, off }); // Don't worry about the values here for now; we'll explain that below.\nconsole.log(Object.keys(myTaggedUnion)); // [\"on\", \"off\"]\n```\n\nThe value of each property on the returned `TaggedUnion` depends on the value of the property with the same name on the `DefinitionObject`.\n\nIn order to understand what the values are, you'll need to understand a type called `MemberObject`.\n\nA `MemberObject` is an object that represents an \"instance\" of the union you're describing with `makeTaggedUnion`. They're what you can `match` against!\nEvery `MemberObject` has a string representing which variant it is and can hold some data. You can visualize them like this:\n\n```ts\ntype MemberObject = {\n  variant: string;\n  data: any;\n};\n```\n\nSo, for each property that was on your `DefinitionObject`, the corresponding property on the `TaggedUnion` is as follows:\n\n- If the `DefinitionObject`'s property value was `none` (the other thing you imported), then the `TaggedUnion`'s corresponding property is a `MemberObject` whose data property holds `undefined`, and whose variant property holds the key from the property on the `DefinitionObject`.\n- If the `DefinitionObject`'s property value was instead a function, then the `TaggedUnion`'s corresponding property is a function that accepts the same parameters as the function on the `DefinitionObject`, and returns a `MemberObject` whose data property holds the return value of the function on the `DefinitionObject`, and whose variant property holds the key from the property on the `DefinitionObject`.\n\nYou can visualize this as follows:\n\n<!-- prettier-ignore -->\n```ts\ntype TaggedUnion = {\n  [for every property in the DefinitionObject you passed in]:\n    | { /* if the property value was none: */\n      variant: the property key,\n      data: undefined\n    }\n    | / * if the property value was a function: */\n      (...args: Parameters<the function that was on this property>) => {\n        variant: the property key,\n        data: ReturnType<the function that was on this property>\n      }\n}\n```\n\nSo, more concretely, if we did this:\n\n```ts\nimport { makeTaggedUnion, none } from \"safety-match\";\n\nconst myTaggedUnion = makeTaggedUnion({\n  on: (voltage: number, current: number) => ({ voltage, current }),\n  off: none,\n});\n```\n\nThen `myTaggedUnion` would have this type:\n\n```ts\n{\n  on: (voltage: number, current: number) => {\n    variant: \"on\",\n    data: { voltage: number, current: number }\n  },\n  off: {\n    variant: \"off\",\n    data: undefined\n  }\n}\n```\n\nWhich means that you could get a `MemberObject` from `myTaggedUnion` like this:\n\n```ts\nconst memberObj = myTaggedUnion.off; // memberObj is a MemberObject with variant \"off\" and data undefined\nconst anotherMemberObj = myTaggedUnion.on(3.3, 0.1); // anotherMemberObj is a MemberObject with variant \"on\" and data { voltage: 3.3, current: 0.1 }\n```\n\nNow, the point of doing all this, is that you can `match` over a `MemberObject` whose variant you don't know, and treat it differently depending on which variant it is.\n\nRemember earlier how I said you could visualize a `MemberObject` like this?\n\n```ts\ntype MemberObject = {\n  variant: string;\n  data: any;\n};\n```\n\nWell, that's not actually the whole story. `MemberObject`s also have a `match` property on them:\n\n```ts\ntype MemberObject = {\n  variant: string;\n  data: any;\n  match: Function;\n};\n```\n\nIt's a function that you can call to branch execution depending on the `type` of the `MemberObject`.\n\nTo use it, you pass in an object we call the \"Cases Object\". This object should have a property for each variant, whose value is a function to be run if the `MemberObject` being matched has the variant in question. The function will receive the `MemberObject`'s data.\n\nHere's what it looks like to use, using a `MemberObject` from the `myTaggedUnion` from earlier code blocks:\n\n```ts\n// Assuming a variable named `memberObj` is defined, which is a MemberObject from `myTaggedUnion`:\nmemberObj.match({\n  on: ({ voltage, current }) => {\n    console.log(`Voltage: ${voltage}, Current: ${current}`);\n  },\n  off: () => {\n    console.log(\"The system is off.\");\n  },\n});\n```\n\nWe can also use the property key `_` in the Cases Object. If we do that, we don't have to specify every variant; any variants we don't specify will get handled by the `_` handler.\n\nUsing `_` isn't very useful for a `TaggedUnion` with only 2 variants, but with more variants, it's more useful. Here's an example that uses a `TaggedUnion` with more variants:\n\n```ts\nconst LoadState = makeTaggedUnion({\n  Unstarted: none,\n  Loading: (percentLoaded: number) => percentLoaded,\n  Loaded: (response: Buffer) => response,\n  Error: (error: Error) => error,\n});\n\nconst state = /* a MemberObject from LoadState */\n\nconst amountLoaded: number = state.match({\n  Loading: (percentLoaded) => percentLoaded,\n  Loaded: () => 100,\n  _: () => 0,\n});\n\nconst errorMessage: string | null = state.match({\n  Error: (error) => error.message,\n  _: () => null,\n});\n```\n\nNow that you understand:\n\n- How to make a `TaggedUnion`,\n- how to get `MemberObject`s from that `TaggedUnion`,\n- and how to use `match` on `MemberObject`s to branch behavior,\n\nThe only thing left that you need to know is how to get a type that describes a `MemberObject` for a given `TaggedUnion`.\n\nThis is important, since the idea of `safety-match` is that you'll pass `MemberObject`s around that represent values in your application. So you'll need to annotate functions that receive or return `MemberObject`s appropriately.\n\nThe way you do this is by using a helper type from the `safety-match` package called `MemberType`:\n\n```ts\n// TypeScript:\nimport {MemberType} from \"safety-match\";\n// Flow:\nimport {type MemberType} from \"safety-match\";\n```\n\nThen you pass your `TaggedUnion` in as a type parameter to `MemberType` to get a new type that described the `MemberObject`s for that `TaggedUnion`:\n\n```ts\nconst myTaggedUnion = makeTaggedUnion({\n  on: (voltage: number, current: number) => ({ voltage, current }),\n  off: none,\n});\n\ntype myTaggedUnionMember = MemberType<typeof myTaggedUnion>;\n```\n\nNow you can use it anywhere you would use a type annotation:\n\n```ts\n// In a variable definition...\nconst memberObj: myTaggedUnionMember = myTaggedUnion.off;\n\n// In a function parameter...\nfunction displayStringForMemberObj(obj: myTaggedUnionMember) {\n  return obj.match({\n    on: (voltage: number, current: number) =>\n      `voltage: ${voltage} volts, current: ${current} amps`,\n    off: () => `system is off`,\n  });\n}\n\n// Etc\n```\n\nIf you are using TypeScript, you can even give the member type the same name as the `TaggedUnion` variable:\n\n```ts\nconst LoadState = makeTaggedUnion({\n  Unstarted: none,\n  Loading: (percentLoaded: number) => percentLoaded,\n  Loaded: (response: Buffer) => response,\n  Error: (error: Error) => error,\n});\ntype LoadState = MemberType<typeof LoadState>;\n\nlet state: LoadState = LoadState.Unstarted;\n```\n\nBut this isn't supported in Flow.\n\n## Note About the `variant` Property\n\nAlthough a `MemberObject` has a `variant` property, and you could theoretically use it in an `if` or `switch` statement, you should generally rely on `.match` for branching behavior instead.\n\nHowever, it's often useful to use the `variant` property when logging a `MemberObject`.\n\n## Flow Limitations\n\n### Data falls back to any in some (uncommon) places\n\nDue to limitations in Flow, there are a few places where TypeScript knows what type something is, but Flow does not (and has to use `any` instead). These are:\n\n- The data passed into a `_` handler in a match\n- The `data` property on a `MemberObject` (but not the data passed into non-`_` match handlers; those are typed).\n\n### Old versions don't handle match properly\n\nIf you're using an old version of flow, match might report errors even though you're using it correctly. The current version of flow at time of writing is 0.134.0.\n\n### May need to annotate `TaggedUnion`s in `types_first` mode\n\nIf flow is configured to use `types_first` mode (which is the default in flow 0.134.0 and higher), you may need to annotate your `TaggedUnion` objects in order to export them from modules. You'll know you need to do this if flow gives you an error like this:\n\n```\nCannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this expression.\n```\n\nIf you get such an error, and your code looks something like this:\n\n```ts\nimport { makeTaggedUnion, none } from \"safety-match\";\n\nexport const myTaggedUnion = makeTaggedUnion({\n  /* variants... */\n});\n```\n\nYou can make flow happy by changing it to this:\n\n```ts\nimport {makeTaggedUnion, none, type TaggedUnion} from \"safety-match\";\n\nconst myDefObj = {\n  /* variants... */\n};\n\nexport const myTaggedUnion: TaggedUnion<typeof myDefObj> = makeTaggedUnions(myDefObj);\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}