{"_id":"@bondzioyo/football-scoreboard","_rev":"7-d848980aec16003c96c7f93f95bed282","name":"@bondzioyo/football-scoreboard","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.1":{"name":"@bondzioyo/football-scoreboard","version":"1.0.1","keywords":["scoreboard","football"],"author":{"name":"Wojciech Świątek"},"license":"MIT","_id":"@bondzioyo/football-scoreboard@1.0.1","maintainers":[{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"}],"dist":{"shasum":"4562d2a6a70e42ddb6f0b5c6e81cd9fd2956e524","tarball":"https://registry.npmjs.org/@bondzioyo/football-scoreboard/-/football-scoreboard-1.0.1.tgz","fileCount":6,"integrity":"sha512-SRAQ1BrVogLawNhU+6vbQ36hWmGg229ldyV79CtAV9EiGg7KgQtcKHl39mnlvKDhPKKESN77CajZgGdWhqBibA==","signatures":[{"sig":"MEYCIQDkSPuVkDyezNDGDvDQRfHQxL2Jk8+mxA3Rjd9PewWDyQIhAKNX1yPEmbr0XJZ9E3z7+LaW6x9bcWBUkpNj2wCDK20r","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13296},"main":"dist/index.cjs","_from":"file:bondzioyo-football-scoreboard-1.0.1.tgz","types":"dist/types/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"scripts":{"test":"vitest","build":"tsup src/index.ts --format esm,cjs --dts --out-dir dist --clean"},"_npmUser":{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"},"_resolved":"/private/var/folders/fm/x3_bm__x74ggy02dmcp748b40000gn/T/0bd1aca96b84f65ea39640e5714cd6fb/bondzioyo-football-scoreboard-1.0.1.tgz","_integrity":"sha512-SRAQ1BrVogLawNhU+6vbQ36hWmGg229ldyV79CtAV9EiGg7KgQtcKHl39mnlvKDhPKKESN77CajZgGdWhqBibA==","_npmVersion":"10.9.3","description":"Simple library for managing live football matches","directories":{},"_nodeVersion":"22.19.0","dependencies":{"uuid":"^13.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.7.0"},"_npmOperationalInternal":{"tmp":"tmp/football-scoreboard_1.0.1_1759783861053_0.4390462339581398","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bondzioyo/football-scoreboard","version":"1.0.2","keywords":["scoreboard","football"],"author":{"name":"Wojciech Świątek"},"license":"MIT","_id":"@bondzioyo/football-scoreboard@1.0.2","maintainers":[{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"}],"dist":{"shasum":"ae4ddefd4aea65bb88d81ff21c79cc829bb8eea2","tarball":"https://registry.npmjs.org/@bondzioyo/football-scoreboard/-/football-scoreboard-1.0.2.tgz","fileCount":4,"integrity":"sha512-VwAZPU6sxSpvwDi10bDnKIjRV6hKs0BaJf1YfrszaSseZTvSPOvfaZ/4eLj2a/1TMT1cSa/J2/lKFUm6lHLEuw==","signatures":[{"sig":"MEUCIQC93aB/nKoQ/jqEhiFBNF6zKg8jzXG8FpI+XWeR8yVbqgIgQSkp48mKAP6NeS9snaIvwMoSrFup8XL4xfEas/BOEtQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8106},"main":"dist/index.cjs","_from":"file:bondzioyo-football-scoreboard-1.0.2.tgz","types":"dist/types/index.d.ts","module":"dist/index.js","scripts":{"test":"vitest","build":"tsup src/index.ts --dts --out-dir dist --clean"},"_npmUser":{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"},"_resolved":"/private/var/folders/fm/x3_bm__x74ggy02dmcp748b40000gn/T/72210ef1ca1727dfe92cda4594df3135/bondzioyo-football-scoreboard-1.0.2.tgz","_integrity":"sha512-VwAZPU6sxSpvwDi10bDnKIjRV6hKs0BaJf1YfrszaSseZTvSPOvfaZ/4eLj2a/1TMT1cSa/J2/lKFUm6lHLEuw==","_npmVersion":"10.9.3","description":"Simple library for managing live football matches","directories":{},"_nodeVersion":"22.19.0","dependencies":{"uuid":"^13.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.7.0"},"_npmOperationalInternal":{"tmp":"tmp/football-scoreboard_1.0.2_1759785363671_0.8227670855337608","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bondzioyo/football-scoreboard","version":"1.0.3","keywords":["scoreboard","football"],"author":{"name":"Wojciech Świątek"},"license":"MIT","_id":"@bondzioyo/football-scoreboard@1.0.3","maintainers":[{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"}],"dist":{"shasum":"24d106dc7b087586e535f4a98858286592760c07","tarball":"https://registry.npmjs.org/@bondzioyo/football-scoreboard/-/football-scoreboard-1.0.3.tgz","fileCount":5,"integrity":"sha512-+jNxhP4pYhhxqzo2+UPGt37LAVFK7L96oERO6NSNt0c3IHO4bGm9lKwGoc300pkw23IVKKUblB1fp9Ynw9VKnQ==","signatures":[{"sig":"MEUCIQDv/5pz31ONWNmQuzVHFDUEE7ESDzSWC1fG29ggjQP6lAIgdU3Yc4BjzthTqxk4uThhW4eMIk8FZMzVXBUOwnBPEn4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10494},"main":"dist/index.js","_from":"file:bondzioyo-football-scoreboard-1.0.3.tgz","types":"dist/index.d.ts","scripts":{"test":"vitest","build":"tsup src/index.ts --dts --out-dir dist --clean"},"_npmUser":{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"},"_resolved":"/private/var/folders/fm/x3_bm__x74ggy02dmcp748b40000gn/T/82c9c0785391b89e660ba9dc9fdce0a8/bondzioyo-football-scoreboard-1.0.3.tgz","_integrity":"sha512-+jNxhP4pYhhxqzo2+UPGt37LAVFK7L96oERO6NSNt0c3IHO4bGm9lKwGoc300pkw23IVKKUblB1fp9Ynw9VKnQ==","_npmVersion":"10.9.3","description":"Simple library for managing live football matches","directories":{},"_nodeVersion":"22.19.0","dependencies":{"uuid":"^13.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.7.0"},"_npmOperationalInternal":{"tmp":"tmp/football-scoreboard_1.0.3_1759786420317_0.8309965601757874","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@bondzioyo/football-scoreboard","version":"1.0.4","description":"Simple library for managing live football matches","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"vitest","build":"tsup src/index.ts --dts --out-dir dist --clean"},"keywords":["scoreboard","football"],"author":{"name":"Wojciech Świątek"},"license":"MIT","packageManager":"pnpm@10.17.1","devDependencies":{"@types/node":"^24.7.0","tsup":"^8.5.0","typescript":"^5.9.3","vitest":"^3.2.4"},"dependencies":{"uuid":"^13.0.0"},"_id":"@bondzioyo/football-scoreboard@1.0.4","gitHead":"781f5fb267f37a3fdfcadf440bcc5a63057a1cc2","_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-uwFsMECe3NjVBHIfshGJQkW5kqBlvcPy2oEMj40Uyvi+uaFLRKk5m2Bdlpl79BKVgo8z5/gfGGC16H9MGqXxLA==","shasum":"36ce770543931b75038fe7d5b0c5b06f222295e3","tarball":"https://registry.npmjs.org/@bondzioyo/football-scoreboard/-/football-scoreboard-1.0.4.tgz","fileCount":5,"unpackedSize":13341,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGLW1JYbOmBgI71TlavneyMa1yp5CY63uBnQ3bpvxHOwAiEA6L22hdpVMxDFwWqOCYw01fFc3msb4xHgukmknRb/wVA="}]},"_npmUser":{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"},"directories":{},"maintainers":[{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/football-scoreboard_1.0.4_1759837442217_0.06749146015248941"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-06T20:51:00.971Z","modified":"2025-10-07T11:44:02.551Z","1.0.0":"2025-10-06T20:34:14.796Z","1.0.1":"2025-10-06T20:51:01.272Z","1.0.2":"2025-10-06T21:16:03.852Z","1.0.3":"2025-10-06T21:33:40.517Z","1.0.4":"2025-10-07T11:44:02.390Z"},"author":{"name":"Wojciech Świątek"},"license":"MIT","keywords":["scoreboard","football"],"description":"Simple library for managing live football matches","maintainers":[{"name":"bondzioyo","email":"wojciechswiatek.lbn@gmail.com"}],"readme":"# Football ScoreBoard\n\nSimple library for managing live football matches.\n\n## Installation\n\nGet library from npm:\n\n```bash\n  npm install @bondzioyo/football-scoreboard\n```\n\n#### or\n\n```bash\n  pnpm add @bondzioyo/football-scoreboard\n```\n\n## Features\n\n- Start a game\n- Update scores\n- Finish a game\n- Get summary of active games sorted by:\n  - Total score (descending)\n  - Start time (newer first)\n\n## Documentation\n\n| Method                | Description                                                     |\n| :-------------------- | :-------------------------------------------------------------- |\n| `setMatch`            | A method for creating a match.                                  |\n| `getMatchById`        | A method that retrieves a single match by its `id`.             |\n| `getMatchByTeamNames` | A method that retrieves a single match by its playing teams.    |\n| `updateScore`         | A method for updating the result.                               |\n| `finishMatch`         | A method that ends ongoing match.                               |\n| `getSummary`          | A method that returns the results of currently ongoing matches. |\n\n#### `setMatch`\n\n```ts\n  setMatch(home: string, away: string): id\n```\n\n| Parameter | Description    |\n| :-------- | :------------- |\n| `home`    | Home team name |\n| `away`    | Away team name |\n\n#### `getMatchById`\n\n```ts\n  getMatchById(id: string): Readonly<Match> | undefined\n```\n\n| Parameter | Description                 |\n| :-------- | :-------------------------- |\n| `id`      | ID of the match to retrieve |\n\n#### `getMatchByTeamNames`\n\n```ts\n  getMatchByTeamNames(home: string, away: string): Readonly<Match> | undefined;\n```\n\n| Parameter | Description    |\n| :-------- | :------------- |\n| `home`    | Home team name |\n| `away`    | Away team name |\n\n#### `updateScore`\n\n```ts\n   updateScore(id: string, homeScore?: number, awayScore?: number): void;\n```\n\n| Parameter   | Description                    |\n| :---------- | :----------------------------- |\n| `id`        | ID of the match to update      |\n| `homeScore` | New home team score (optional) |\n| `awayScore` | New away team score (optional) |\n\n#### `finishMatch`\n\n```ts\n  finishMatch(id: string): void;\n```\n\n| Parameter | Description            |\n| :-------- | :--------------------- |\n| `id`      | ID of the match to end |\n\n#### `getSummary`\n\n```ts\n   getSummary(): ReadonlyArray<Match>;\n```\n\n## Usage\n\n```ts\nimport { Scoreboard } from \"scoreboard\";\n\nconst sb = new Scoreboard();\n\nconst id = sb.setMatch(\"Mexico\", \"Canada\");\n\nconst match = sb.getMatchById(id);\n\nsb.updateScore(id, 1, 0);\n\nconsole.log(match); // {\n//   id: 'eca8ea70-...',\n//   home: 'Mexico',\n//   away: 'Canada',\n//   scoreHome: 1,\n//   scoreAway: 0,\n//   createdAt: 1759777086199,\n//   updatedAt: 1759777086199\n// }\n\nsb.finishMatch(id);\n```\n\n## Run Locally\n\nClone the project\n\n```bash\n  git clone https://github.com/bondzioyo/football-scoreboard.git\n```\n\nGo to the project directory\n\n```bash\n  cd football-scoreboard\n```\n\nInstall dependencies\n\n```bash\n  pnpm install\n```\n\n## Running Tests\n\nTo run tests, run the following command\n\n```bash\n  pnpm test\n```\n\n## Assumptions\n\n- A lightweight, in-memory library that uses a `Map` to store match data, providing efficient lookup and management operations.\n\n- Developed following the **Test-Driven Development** (TDD) methodology to ensure correctness and clean design from the start.\n\n- Matches are represented as plain object literals, reducing unnecessary complexity compared to using classes.\n\n- Written in **TypeScript** to ensure strong typing for methods and data structures, improving reliability and maintainability.\n\n- Unit tests are implemented with **Vitest** to verify functionality and ensure robustness.\n\n- The uuid library is used to generate unique match identifiers.\n\n- The library prevents creating new matches involving teams that are already playing an ongoing match.\n\n- Supports updating the score for one or both teams, with validation ensuring that new values cannot be lower than previous ones (no need to check for negatives since a match starts at 0:0).\n\n- Published as a **scoped npm package** for convenient installation and to avoid naming conflicts with other packages.\n\n- Provides methods to retrieve matches by `id` or, if the `id` is unknown, by team names.\n\n## License (MIT)\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\nCopyright (c) 2025 Wojciech Świątek, https://github.com/bondzioyo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","readmeFilename":"README.md"}