{"_id":"@davidmz/just-router","_rev":"5-99ee6c7d8332f0d68ed435fa3d538fe1","name":"@davidmz/just-router","dist-tags":{"latest":"0.3.1"},"versions":{"0.1.0":{"name":"@davidmz/just-router","version":"0.1.0","description":"A very simple path matching and routing library","keywords":["path","match","router","routing","route"],"homepage":"https://github.com/davidmz/just-router","author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","main":"build/cjs/index.js","module":"build/esm/index.js","types":"build/esm/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"~8.1.2","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.48.2","@typescript-eslint/parser":"^5.48.2","del-cli":"^5.0.0","eslint":"^8.32.0","eslint-config-prettier":"^8.6.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^9.0.0","eslint-plugin-unused-imports":"^2.0.0","npm-run-all":"~4.1.5","prettier":"2.8.3","size-limit":"~8.1.2","ts-node":"^10.9.1","typescript":"^4.9.4","vitest":"^0.28.1"},"size-limit":[{"path":"build/esm/index.js","import":"{ router, route, bunch }","limit":"1 kB"}],"scripts":{"clean":"del-cli build/cjs build/esm","build":"eslint && tsc && tsc -p ./tsconfig.esm.json","test":"vitest --run","test-watch":"vitest","lint":"eslint","size":"size-limit"},"_id":"@davidmz/just-router@0.1.0","_integrity":"sha512-B3KWtiCuUTzsajoqXZBff1jHSCxC3Obn266GJ+HghI9bpoqickZ7N6soPXiXER55UnkeqPylCk/bvEffDvGhVw==","_resolved":"C:\\Users\\David\\AppData\\Local\\Temp\\771d81e7e93a07066d87cc710690aa0f\\davidmz-just-router-0.1.0.tgz","_from":"file:davidmz-just-router-0.1.0.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.6.0","dist":{"integrity":"sha512-B3KWtiCuUTzsajoqXZBff1jHSCxC3Obn266GJ+HghI9bpoqickZ7N6soPXiXER55UnkeqPylCk/bvEffDvGhVw==","shasum":"41a7260e66cf2800686cfb6f11ef4e371dc69d04","tarball":"https://registry.npmjs.org/@davidmz/just-router/-/just-router-0.1.0.tgz","fileCount":30,"unpackedSize":141919,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCN1wWq8mejo1sMftMqycE++kpYwUTxAljdk4EqrVrNggIhAIXH4UqZKzZB08BiyJWje7jLr9n/jI2pJ0NASDLKUxFL"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1NeJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqtWw//WXIEkWieRBT9v0gnABSm+mymhJUNllc4nGvNUd4SPfcetAch\r\nZOTVxUDyNgF8Qu/+s7Ul830jQX/iqnPuNUNZEGsQSzYcJEleY6uuBNZire79\r\nLSgki0OTwgGRj7fMvFTjjWbhh27gY0wGpNd9EtYfJALXjY2W2gQwgr7kBboh\r\nvN2g5iRX3ZJQLWxMe7aY6QuY/b6HlJgqC+z2itCLhHuJN3HPZZWPVCndDWSo\r\nR4bjDdLb5DmMSAWTXEnK/B5eNIAKdp59QhMRKgDHmNzvu/Br+pdSnXTJtGj5\r\nlAeE1ShRLFEXREJYT9OJWnSp/GDdNHlzWPJ/GIf6MYqRISP5DgemoaJAqjco\r\nvMxkDK1kMhGHEQDFvldVwh+0GUKWmK6jY3B+v0zFevTfGDmn6NuP1o1RwN7U\r\nhWAsFaDPxBpLVFKtMFqUrxTPo/H/3tNQnwLuoro0Bb28PgksR4F3jvqq3LPU\r\n8oiRHHZarJ0OUJpZz8eo8zE9U7wZgoc2klLmx0LUlt/HKhm86MmafTA51FKh\r\n7ormijoKXX8lCkvLrZAgQ/z8Axjj01QvAjMOza9RWltV5DuBDzXhbJ9OawFQ\r\nma0GHWqx+0YlwDaqShFA82Xw+fI6JXv7UR0F0H1wQqAhKXoSxspm9gwuj4vg\r\n5GQQYWhNbw9AWxYMRX8DBs5wvfbw1MGTyFY=\r\n=otKC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"davidmz","email":"david@hiero.ru"},"directories":{},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-router_0.1.0_1674893193375_0.6214431689444604"},"_hasShrinkwrap":false},"0.1.1":{"name":"@davidmz/just-router","version":"0.1.1","description":"A very simple path matching and routing library","keywords":["path","match","router","routing","route"],"homepage":"https://github.com/davidmz/just-router","author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","main":"build/cjs/index.js","module":"build/esm/index.js","types":"build/esm/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"~8.1.2","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.48.2","@typescript-eslint/parser":"^5.48.2","del-cli":"^5.0.0","eslint":"^8.32.0","eslint-config-prettier":"^8.6.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^9.0.0","eslint-plugin-unused-imports":"^2.0.0","npm-run-all":"~4.1.5","prettier":"2.8.3","size-limit":"~8.1.2","ts-node":"^10.9.1","typescript":"^4.9.4","vitest":"^0.28.1"},"size-limit":[{"path":"build/esm/index.js","import":"{ createRouter, route, bunch }","limit":"1 kB"}],"scripts":{"clean":"del-cli build/cjs build/esm","build":"eslint && tsc && tsc -p ./tsconfig.esm.json","test":"vitest --run","test-watch":"vitest","lint":"eslint","size":"size-limit"},"_id":"@davidmz/just-router@0.1.1","_integrity":"sha512-rHntHzD8RPTWrsGL1GZ/GhDuTt0ndpQZtLM0TJ3e619cLQCyL2lkc7Jv8Y9GSvoDp8iq2gDVUItEN0rHNbs5Gw==","_resolved":"C:\\Users\\David\\AppData\\Local\\Temp\\2abd40ab09a67a5c5b750a174ac1d497\\davidmz-just-router-0.1.1.tgz","_from":"file:davidmz-just-router-0.1.1.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.6.0","dist":{"integrity":"sha512-rHntHzD8RPTWrsGL1GZ/GhDuTt0ndpQZtLM0TJ3e619cLQCyL2lkc7Jv8Y9GSvoDp8iq2gDVUItEN0rHNbs5Gw==","shasum":"9d8c4b16c42759a446cb05a2799507265545ef3d","tarball":"https://registry.npmjs.org/@davidmz/just-router/-/just-router-0.1.1.tgz","fileCount":18,"unpackedSize":23424,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGPQwsNW3JYQ46M0iIr4GXRxXO0iGqk6k1HtdFITtp+hAiAI3x3ir4mySizEEStl5Re22pm6ztq7wXv2hKhfH/EeXg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1NqfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrH/w//Va5LIZS2Vzidr+txU61sQtiNdkgjKCjkHOVLZSaDPG3blR0f\r\n8Zj3BFWzJHILBEKW18v+QI/DxUtFplp8EW0nguPgI2IFEqjWKsiu9Y9vScQ7\r\nzs7MeQg8yF+BaN0ZSfoPoKM5btby8W/4RiKl0Fck0CBw/8ZMIi0vsO/xDWLH\r\nCANIFhbNI3PX7EIuNaijnAll7vS/92ylvKLC+3Dz6JwQJaovtFsuKOBwMOb6\r\nJorqnguj00Q5BGdy/1y5fro7efdS2roDRJyijOE0btz+dx/f6DaafEDwUMl8\r\npUQEVYCPA8rQpB6kbb0oUhugN6VDG241NwFGE4coodNK0VPhquu2Nv/m7zZo\r\n0v8fH81osjJBgRZM7wE5lFimBJobuQZhQkhR06pgsB91CuV5eGXbsMLEXZA+\r\nBuWadN88i7J0ib24bzJ7xl67LQAEwyCaAQK7U8YGkybaK7Gum4mNgrSRj7T5\r\n0yNqqJ1IgytSpVu5j8x943y6DEp27NmQrpVLmp3WxsLCY+6D8xcKizNbCVvx\r\nXSAFdx6mS9S2avuERqjLDO+N+1zjQDockNN168iGozxMg99/F8qX9UW6aVr/\r\n2ljzn0og5sq4rsOVKLvzDHBmxCKn5ktXFGOuQJ4DBiVtSQLEI/kv+BJhgidd\r\n8eQT75GNDH3JuJ0xHk85GufUVCpjPoGVxDM=\r\n=pAIi\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"davidmz","email":"david@hiero.ru"},"directories":{},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-router_0.1.1_1674893983059_0.8046555205915709"},"_hasShrinkwrap":false},"0.1.2":{"name":"@davidmz/just-router","version":"0.1.2","description":"A very simple path matching and routing library","keywords":["path","match","router","routing","route"],"homepage":"https://github.com/davidmz/just-router","author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","main":"build/cjs/index.js","module":"build/esm/index.js","types":"build/esm/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"~8.1.2","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.48.2","@typescript-eslint/parser":"^5.48.2","del-cli":"^5.0.0","eslint":"^8.32.0","eslint-config-prettier":"^8.6.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^9.0.0","eslint-plugin-unused-imports":"^2.0.0","npm-run-all":"~4.1.5","prettier":"2.8.3","size-limit":"~8.1.2","ts-node":"^10.9.1","typescript":"^4.9.4","vitest":"^0.28.1"},"size-limit":[{"path":"build/esm/index.js","import":"{ createRouter, route, bunch }","limit":"700 B"}],"scripts":{"clean":"del-cli build/cjs build/esm","build":"eslint && tsc && tsc -p ./tsconfig.esm.json","test":"vitest --run","test-watch":"vitest","lint":"eslint src","size":"size-limit"},"_id":"@davidmz/just-router@0.1.2","_integrity":"sha512-07n03lRZAowijTYxx5BhAimDG1jjQ4XLmuNfiZiQr9KTdOsYOg5IR44YUPtuIFiSZ7am5G+bPnaQBQ/cRubT2Q==","_resolved":"C:\\Users\\David\\AppData\\Local\\Temp\\5dbfd7f24f614acc13df2a1342b04ac7\\davidmz-just-router-0.1.2.tgz","_from":"file:davidmz-just-router-0.1.2.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.6.0","dist":{"integrity":"sha512-07n03lRZAowijTYxx5BhAimDG1jjQ4XLmuNfiZiQr9KTdOsYOg5IR44YUPtuIFiSZ7am5G+bPnaQBQ/cRubT2Q==","shasum":"e1bb9b29d54ad01ce6a81cd814db20ba0a6f6230","tarball":"https://registry.npmjs.org/@davidmz/just-router/-/just-router-0.1.2.tgz","fileCount":18,"unpackedSize":22045,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0OM2mKMF6RLqiaOf6gc4Yr/wVZYgTvdLRrzYKnU9c6AIhAJSyVrsGe8DzQ/RsR/Flg5vlzvIvm2Po91mqiRv6PCqV"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj17ZfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr24w/5ADO7i3ui75xZzDiz2ceKEalNoIFGulYEc5Es+ZdlWl8jXPPu\r\nMk7S4pNg1tyQhac2bQj727qEbU3WtZAP0P8tITRgXqExtHIKvKttWqbvoO9v\r\nwx+VZtxIKpz0flWURfWx5lilQw3X/io6Bw8F0+m89q9+a90kOCVEqt59+khc\r\n8n9KxyeU/uz2huc2/xWqeU8BkYkqaGNxUnhFNdF3oJwlOzO3OMUJW2j/A4Gw\r\n4oT+D17B3iH6oKIblox506ZHn41eVp0Nb9FyEjvEgW4x4Op2eNqMcG0MUmXN\r\nfKIRYj+LrBoFVKbxpJ3ZwaxuIiy1HT4dfb+nX4IkcBu5LUhNtoJnbIZ3hFmw\r\n8Fj8gkf/vdCenY3bP4ZQ33Dtt5kytTSrODG5vPHCkPkefSBxD3yugKs9L/38\r\nAY2urVw+NKmHjX0YIt3MpSYZncAPEyOyWX+CtbCtBuMnhMEPyDZf1wSBq8mL\r\nya4+KXXPDyX/rXaJ04gvdpwsXbvisdtS4fEDVeeRL9THoYXBHG+ONwtHQJoN\r\nKkEoG13JlEs8TJyeOKg0i0t0sLuFlSMPq6yPPDk1ebgNbQPHEqW1K3TfZLPu\r\nPTFAYV7QC/SDFRi+1GqpyiYV3tKTxsa981I1xy+GinbvG98xqh+aJvE7AOZx\r\nZeiT6LM1yWld1QoTX5zl5XQjn0AHTgIB854=\r\n=XP1+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"davidmz","email":"david@hiero.ru"},"directories":{},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-router_0.1.2_1675081311082_0.9812364244254701"},"_hasShrinkwrap":false},"0.2.0":{"name":"@davidmz/just-router","version":"0.2.0","description":"A very simple path matching and routing library","keywords":["path","match","router","routing","route"],"homepage":"https://github.com/davidmz/just-router","author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","main":"build/cjs/index.js","module":"build/esm/index.js","types":"build/esm/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"~8.1.2","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.48.2","@typescript-eslint/parser":"^5.48.2","del-cli":"^5.0.0","eslint":"^8.32.0","eslint-config-prettier":"^8.6.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^9.0.0","eslint-plugin-unused-imports":"^2.0.0","npm-run-all":"~4.1.5","prettier":"2.8.3","size-limit":"~8.1.2","ts-node":"^10.9.1","typescript":"^4.9.4","vitest":"^0.28.1"},"size-limit":[{"path":"build/esm/index.js","import":"{ createRouter, route, bunch }","limit":"700 B"}],"scripts":{"clean":"del-cli build/cjs build/esm","build":"eslint && tsc && tsc -p ./tsconfig.esm.json","test":"vitest --run","test-watch":"vitest","lint":"eslint src","size":"size-limit"},"_id":"@davidmz/just-router@0.2.0","_integrity":"sha512-9rJIBr593gJuovOsSWCAJMOkY4eBLXzZLIitQgAZjuT47aWRlZrb79OpTBWxP1iUdvlfvJ4hlVX+9sgS5PhdSg==","_resolved":"C:\\Users\\David\\AppData\\Local\\Temp\\3a88d3f6da55cd3ef3e97c6258a9c368\\davidmz-just-router-0.2.0.tgz","_from":"file:davidmz-just-router-0.2.0.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.6.0","dist":{"integrity":"sha512-9rJIBr593gJuovOsSWCAJMOkY4eBLXzZLIitQgAZjuT47aWRlZrb79OpTBWxP1iUdvlfvJ4hlVX+9sgS5PhdSg==","shasum":"7e747ddfa58902f01cb71997c1f243aad1ca3dfc","tarball":"https://registry.npmjs.org/@davidmz/just-router/-/just-router-0.2.0.tgz","fileCount":18,"unpackedSize":30508,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClh45GjK9I6BlMhjc/WFE+aKrdrqVx5+8fhAUcmUSpFAIgJ64DtVKkL3xXJHQ0EfVLgTjVgNrjrow4T1Sf5ZhJAjo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2s5YACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmow+BAAi7QfqtV4r51QCTmX5UwfA5RAPS6bSGU1uGVVjz+wH7TAmyCw\r\nClbS0sGuJE42R3Od2rESqee1D5Bl7MEy0PBCABwp38Sw2U1bAcEymgZEPiRw\r\nZR6QPcRR0uLxNqx15tuH8b1WolBEpKiYV/wtDWqc+hK7EKXdfW6q3f42sFVB\r\noHACBJCerw7D4rDX2SkiYJZfU2pUmYT5d3oGk/Um0wCSWco1ZxCLy0j9gXIL\r\n25+tOULoKooPH+bkOn7N0IWkjdH50uVJh6bM1ym/87zRLOmhEmW87MiDhGTy\r\n6VAVxmcd0Dh/e49U9cHZFYDUiZkjAxgGxkQs0RGtQKdH9s9ke8R1mYbX39Lj\r\nGNnu9N6E4xr8/FmEB0qfJOq12MMeQ2khc1owJi1n1IQRqoO6mfLuuOyfW6+y\r\nAIX8EWayCAwu5LT9D9+FTSCuxpssmjpRXasutcieaRaxTh40f184Py0h5gCg\r\nk5lP2DTy/soBvJoQ+SPol83XKlhL7IVa8dzSycU+6E2RJphEFyptIuxXoJ2r\r\nN6w9Od+6x6DUMJHvNf/dSiHxcinhYcpqg8fKFu9aeRE66OpcRoVEdKYBqiaQ\r\nFHau81fWkKnTu+OUnWtqQ2jiG1VUxALN95WH1tuRSXZVzSIfkgmlVe+ZZ/pk\r\nvnbpciWE6he6ctWKaHAKVKjOt1IxiO4tufw=\r\n=GXPS\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"davidmz","email":"david@hiero.ru"},"directories":{},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-router_0.2.0_1675284056696_0.24089033008686744"},"_hasShrinkwrap":false},"0.3.0":{"name":"@davidmz/just-router","version":"0.3.0","description":"A very simple path matching and routing library","keywords":["path","match","router","routing","route"],"homepage":"https://github.com/davidmz/just-router","author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","main":"build/cjs/index.js","module":"build/esm/index.js","types":"build/esm/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"~8.2.4","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.59.7","@typescript-eslint/parser":"^5.59.7","del-cli":"^5.0.0","eslint":"^8.41.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^10.0.0","eslint-plugin-unused-imports":"^2.0.0","npm-run-all":"~4.1.5","prettier":"2.8.8","size-limit":"~8.2.4","ts-node":"^10.9.1","typescript":"^4.9.4","vitest":"^0.28.1"},"size-limit":[{"path":"build/esm/index.js","import":"{ createRouter, route, bunch }","limit":"750 B"}],"scripts":{"clean":"del-cli build/cjs build/esm","build":"eslint && tsc && tsc -p ./tsconfig.esm.json","test":"vitest --run","test-watch":"vitest","lint":"eslint src","size":"size-limit"},"_id":"@davidmz/just-router@0.3.0","_integrity":"sha512-mGFyPSDXV8ssV8m2IBRR91LdSIRQBaUG2TihAP/xMEgzqVij8vcsXON+WoW2dFFZhevC/YqQ7mIA+3w7MwKg5Q==","_resolved":"C:\\Users\\David\\AppData\\Local\\Temp\\2f6a5f7204e72ce025588615641d6aa4\\davidmz-just-router-0.3.0.tgz","_from":"file:davidmz-just-router-0.3.0.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.6.0","dist":{"integrity":"sha512-mGFyPSDXV8ssV8m2IBRR91LdSIRQBaUG2TihAP/xMEgzqVij8vcsXON+WoW2dFFZhevC/YqQ7mIA+3w7MwKg5Q==","shasum":"e4231b70f4c5487d57079810eebdd85d7180168b","tarball":"https://registry.npmjs.org/@davidmz/just-router/-/just-router-0.3.0.tgz","fileCount":18,"unpackedSize":32414,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFkubrhH/D4uqrxtFn4+Q2y7bLMT6YFnH0W0Jqu3KTvEAiBzJBj8QM8/Huc/G61l01MdT54k2d1tmYgtdcYRihh++A=="}]},"_npmUser":{"name":"davidmz","email":"david@hiero.ru"},"directories":{},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-router_0.3.0_1686403328542_0.8534143302126951"},"_hasShrinkwrap":false},"0.3.1":{"name":"@davidmz/just-router","version":"0.3.1","description":"A very simple path matching and routing library","keywords":["path","match","router","routing","route"],"homepage":"https://github.com/davidmz/just-router","author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","main":"build/cjs/index.js","module":"build/esm/index.js","types":"build/esm/index.d.ts","devDependencies":{"@size-limit/preset-small-lib":"~8.2.4","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.59.7","@typescript-eslint/parser":"^5.59.7","del-cli":"^5.0.0","eslint":"^8.41.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^10.0.0","eslint-plugin-unused-imports":"^2.0.0","npm-run-all":"~4.1.5","prettier":"2.8.8","size-limit":"~8.2.4","ts-node":"^10.9.1","typescript":"^4.9.4","vitest":"^0.28.1"},"size-limit":[{"path":"build/esm/index.js","import":"{ createRouter, route, bunch }","limit":"750 B"}],"scripts":{"clean":"del-cli build/cjs build/esm","build":"eslint && tsc && tsc -p ./tsconfig.esm.json","test":"vitest --run","test-watch":"vitest","lint":"eslint src","size":"size-limit"},"_id":"@davidmz/just-router@0.3.1","_integrity":"sha512-W6jC+5SqJ0hdVy6cGTGQyGJXBVU6kxrZ+Eqef+DATeXOueXyyfEJiVwegoHgnrDgMqeNOAO1pl9AgHz5gytIWg==","_resolved":"C:\\Users\\David\\AppData\\Local\\Temp\\b0913f0051c4f46a9c02d8b06d2d56de\\davidmz-just-router-0.3.1.tgz","_from":"file:davidmz-just-router-0.3.1.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.6.0","dist":{"integrity":"sha512-W6jC+5SqJ0hdVy6cGTGQyGJXBVU6kxrZ+Eqef+DATeXOueXyyfEJiVwegoHgnrDgMqeNOAO1pl9AgHz5gytIWg==","shasum":"6130541fb8232edaeadbfbb0fd7c91b4860bbbaf","tarball":"https://registry.npmjs.org/@davidmz/just-router/-/just-router-0.3.1.tgz","fileCount":18,"unpackedSize":32390,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCBz/h+Vt5c/2Aap+ExDEepcMp0k+Hpmx/u65OikQUiQIgEl7VXKsxWhXPLsYDKFogOO6av0SGLlCCwEZRDXFRabs="}]},"_npmUser":{"name":"davidmz","email":"david@hiero.ru"},"directories":{},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-router_0.3.1_1686403679162_0.25977134132615864"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-28T08:06:33.320Z","0.1.0":"2023-01-28T08:06:33.561Z","modified":"2023-06-10T13:27:59.448Z","0.1.1":"2023-01-28T08:19:43.210Z","0.1.2":"2023-01-30T12:21:51.281Z","0.2.0":"2023-02-01T20:40:56.898Z","0.3.0":"2023-06-10T13:22:08.732Z","0.3.1":"2023-06-10T13:27:59.344Z"},"maintainers":[{"name":"davidmz","email":"david@hiero.ru"}],"description":"A very simple path matching and routing library","homepage":"https://github.com/davidmz/just-router","keywords":["path","match","router","routing","route"],"author":{"name":"David Mzareulyan","email":"david@hiero.ru","url":"https://github.com/davidmz"},"license":"MIT","readme":"# just-router\r\n\r\nA very simple path matching and routing library. It is framework-independent,\r\nworks synchronously, has a small size (< 750 B min/gz) and concise API.\r\n\r\n## Installation\r\n\r\nInstall it from npm as\r\n[@davidmz/just-router](https://www.npmjs.com/package/@davidmz/just-router)\r\n\r\n## Usage (sort of tutorial)\r\n\r\n### What is \"router\" and how to create one\r\n\r\nRouters are created by _createRouter(…)_ call.\r\n\r\nThe router itself has a simple function `<T>(path: string) => T`. It takes path\r\n(string) and returns something that makes sense for your application. It can be,\r\nfo example, a React component or HTML string.\r\n\r\nPath is a regular pathname, the string like \"/path/to/some/thing\". Path actually\r\nprocessed as a list of _segments_: \"/path/to/some/thing\" -> [\"path\", \"to\",\r\n\"some\", \"thing\"]. All slashes are ignored: \"/foo\", \"/foo/\", \"foo\" or \"///foo/\"\r\nare all the same for the router.\r\n\r\n### Handlers (who do everything here)\r\n\r\nThe _createRouter_ function takes single argument of type _Handler_. _Handler_\r\nis the main working type for the all library. It is a function with signature:\r\n\r\n```typescript\r\ntype Handler<T, S extends object = object> = (\r\n  context: Context<S>,\r\n  next: Next<Nullable<T>>\r\n) => Nullable<T>;\r\n```\r\n\r\nIt may look complex because of type declarations, but actually it is very simple\r\nmiddleware-like (as in _koa_ or other routing libs) function that accepts the\r\nrequest _context_ and the _next_ function, and returns type T or nothing (null |\r\nundefined). If handler is a _middleware_ (i.e. it just prepare data for the next\r\nhandlers), it should call _next_. If it is a terminal handler, it shouldn't\r\n(this will cause an error).\r\n\r\nBy the way, the _context_ has the following type:\r\n\r\n```typescript\r\ntype Context<S extends object = object> = {\r\n  // The initial 'path' passed to router. Immutable.\r\n  readonly path: string;\r\n  // The path segments. This list can be altered by handlers.\r\n  segments: string[];\r\n  // Named parameters, taken from path segments (see _param_ handler).\r\n  pathParams: Record<string, string>;\r\n  // An arbitrary request state. Handlers can store everything in it.\r\n  state: S;\r\n};\r\n```\r\n\r\nThe simplest router looks like this:\r\n\r\n```typescript\r\nconst router = createRouter(() => \"Hello!\");\r\n\r\nexpect(router(\"/foo/bar\")).toBe(\"Hello!\");\r\n```\r\n\r\nThis router is pretty useless because it will return \"Hello!\" for any given\r\npath. The _createRouter_ hasn't any path processing logic, we need an additional\r\nhandlers for it.\r\n\r\n### Routes and path matching\r\n\r\nThe _route_ function creates handler that allows to check path segments and call\r\nthe terminal handler (handler that returns value and don't call 'next'):\r\n\r\n```typescript\r\nconst router = createRouter(route(\"foo\", () => \"Hello!\"));\r\n\r\nexpect(router(\"/foo\")).toBe(\"Hello!\");\r\nexpect(() => router(\"/foo/bar\")).toThrow(RouteNotFound);\r\n```\r\n\r\n_route_ takes variable (but at least one) number of arguments. The last argument\r\nmust be a handler function, other can be handler functions, strings, or regexps.\r\n\r\n_route_ internally converts strings and regexps to the regular handlers. String\r\nmeans that the segment must exactly match the string. Regexp also requires\r\nmatch, but can also capture part of the segment (see below).\r\n\r\nThe _route_ arguments forms handlers chain and executes sequentially, being\r\nlinked via the _next_ argument of each other. So `route(a, b, c)` will act like\r\n`a(ctx, () => b(ctx, () => c(ctx, next)))`.\r\n\r\n### Path parameters\r\n\r\nHaving _route_ and middleware handlers, we can now process path parameters. Like\r\nthis:\r\n\r\n```typescript\r\nconst router = createRouter(\r\n  route(\r\n    \"articles\",\r\n    param(\"slug\"),\r\n    (ctx) => \"Article: \" + ctx.pathParams[\"slug\"]\r\n  )\r\n);\r\n\r\nexpect(router(\"/articles/routing\")).toBe(\"Article: routing\");\r\n```\r\n\r\nThe _param_ helper takes current path segment and places it to the context's\r\n_pathParams_ object with the given key.\r\n\r\n### Regexp matchers\r\n\r\nRegexp matchers combines string and _param_ functionality, since it allows you\r\nto both specify a segment pattern and capture come data from it.\r\n\r\nTo match specific segment format just use a relevant regexp: the `/[1-9]\\d*/` will match only the numeric segments.\r\n\r\nTo capture segment or it part(s), use regex [named\r\ngroups](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Backreferences):\r\n\r\n```typescript\r\nconst router = createRouter(\r\n  route(/article(?<id>[1-9]\\d*)/, (ctx) => \"Article ID=\" + ctx.pathParams[\"id\"])\r\n);\r\n\r\nexpect(router(\"/article42\")).toBe(\"Article ID=42\");\r\n```\r\n\r\n### 'split' helper\r\n\r\nRoute arguments work on a per-segment basis, but sometimes it is more convenient\r\nto specify (sub)path as a single string. It is possible with _split_ helper. The following routes are equivalent:\r\n\r\n```typescript\r\nroute(\"path\", \"to\", \"articles\", param(\"id\"), showArticle);\r\nroute(split(\"path/to/articles\"), param(\"id\"), showArticle);\r\n```\r\n\r\n### Root path\r\n\r\nThe root path can be matched by the route with single terminal handler:\r\n\r\n```typescript\r\nconst router = createRouter(route(() => \"I am root!\"));\r\n\r\nexpect(router(\"/\")).toBe(\"I am root!\");\r\n```\r\n\r\n### Bunch of routes\r\n\r\nSo far we have dealt with one route, which matches a single path to a single\r\nterminal handler. In practice we need to handle many different paths, a bunch of\r\nthem. That's what the _bunch_ function is for.\r\n\r\n```typescript\r\nconst router = createRouter(\r\n  bunch(\r\n    route(() => \"Root page\"),\r\n    route(\"foo\", () => \"Foo page\"),\r\n    route(\"bar\", () => \"Bar page\")\r\n  )\r\n);\r\n\r\nexpect(router(\"/\")).toBe(\"Root page\");\r\nexpect(router(\"/foo\")).toBe(\"Foo page\");\r\nexpect(router(\"/bar\")).toBe(\"Bar page\");\r\nexpect(() => router(\"/baz\")).toThrow(RouteNotFound);\r\n```\r\n\r\nThe _bunch_ function takes set of handlers and returns a handler (again!) that:\r\n\r\n- Calls given handlers from first to last;\r\n- Stops on first non-nullish result and returns it.\r\n\r\n### Catch-all handlers\r\n\r\nYou may notice that our router throws a _RouteNotFound_ error it there is not\r\nmatched route. This is because handlers, created with _route_, (almost) always\r\nrequire a complete path match. In practice, we often need a handler for \"all\r\nother\" paths, for example to show the \"Not found\" page.\r\n\r\nFortunately, it's very easy to add it. Remember that the \"bare\" handler doesn't\r\ncare about path matching. So we can do the following:\r\n\r\n```typescript\r\nconst router = createRouter(\r\n  bunch(\r\n    route(\"foo\", () => \"Foo page\"),\r\n    () => \"Not found\"\r\n  )\r\n);\r\n\r\nexpect(router(\"/foo\")).toBe(\"Foo page\");\r\nexpect(router(\"/bar\")).toBe(\"Not found\");\r\n```\r\n\r\n### Greedy handlers\r\n\r\nAs was mentioned earlier, _route_ requires the complete path match. This means\r\nthat at the time the last handler in the chain is called, all segments of the\r\npath must be processed. So the `route(\"foo\", handler)` will match \"/foo\", but\r\nnot \"/foo/bar\", although the last one also starts from \"foo\" segment.\r\n\r\nSometimes we need a \"greedy\" handler that grabs all the remaining segments. In\r\nsuch case, just wrap you handler with _batch_. The handler the _bunch_ returns\r\nis greedy, this allows to make nested bunches.\r\n\r\n```typescript\r\nconst router = createRouter(\r\n  bunch(\r\n    route(\"foo\", () => \"Foo page\"),\r\n    route(\r\n      \"bar\",\r\n      bunch((ctx) => \"Bar page: \" + (ctx.segments.join(\", \") || \"-\"))\r\n    )\r\n  )\r\n);\r\n\r\nexpect(router(\"/foo\")).toBe(\"Foo page\");\r\nexpect(router(\"/bar\")).toBe(\"Bar page: -\");\r\nexpect(router(\"/bar/baz\")).toBe(\"Bar page: baz\");\r\nexpect(router(\"/bar/baz/qux\")).toBe(\"Bar page: baz, qux\");\r\n```\r\n\r\n### Nested bunches\r\n\r\nHere we can create a really complex staff!\r\n\r\n```typescript\r\nconst router = createRouter(\r\n  bunch(\r\n    route(() => \"Home\"),\r\n    route(\"about\", () => \"About\"),\r\n    route(split(\"about/contacts\"), () => \"Contacts\"),\r\n    route(\r\n      \"projects\",\r\n      bunch(\r\n        route(() => \"Projects list\"),\r\n        route(param(\"name\"), (ctx) => \"Project: \" + ctx.pathParams[\"name\"]),\r\n      )\r\n    ),\r\n    route(\r\n      \"admin\",\r\n      checkRights, // Your own logic!\r\n      bunch(\r\n        route(() => \"Admin home\"),\r\n        route(\"users\", () => \"List of users\")\r\n        () => \"Admin page not found\"\r\n      )\r\n    ),\r\n    () => \"Page not found\"\r\n  )\r\n);\r\n\r\nexpect(router(\"/\")).toBe(\"Home\");\r\nexpect(router(\"/about\")).toBe(\"About\");\r\nexpect(router(\"/about/contacts\")).toBe(\"Contacts\");\r\nexpect(router(\"/projects\")).toBe(\"Projects list\");\r\nexpect(router(\"/projects/foo\")).toBe(\"Project: foo\");\r\nexpect(router(\"/admin/foo\")).toBe(\"Admin page not found\");\r\n// ...and so on\r\n```\r\n\r\nThat's all you need to know!\r\n\r\n## API methods signatures\r\n\r\n### createRouter\r\n\r\n```typescript\r\nfunction createRouter<T, S>(route: Handler<T, S>): Router<T>;\r\n```\r\n\r\n### route\r\n\r\n```typescript\r\nfunction route<T, S>(\r\n  ...handlers: [...(string | Handler<T, S>)[], Handler<T, S>]\r\n): Handler<T, S>;\r\n```\r\n\r\n### bunch\r\n\r\n```typescript\r\nfunction bunch<T, S>(...handlers: Handler<T, S>[]): Handler<T, S>;\r\n```\r\n\r\n### param\r\n\r\n```typescript\r\nfunction param<T, S>(name: string): Handler<T, S>;\r\n```\r\n\r\n### split\r\n\r\n```typescript\r\nfunction split<T, S>(path: string): Handler<T, S>;\r\n```\r\n","readmeFilename":"README.md"}