{"id":30799182,"url":"https://github.com/partman7/generic-astar","last_synced_at":"2025-09-05T19:08:54.153Z","repository":{"id":307457842,"uuid":"1029615669","full_name":"PartMan7/generic-astar","owner":"PartMan7","description":"Generic JS/TS A* implementation.","archived":false,"fork":false,"pushed_at":"2025-07-31T10:23:36.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-09T06:54:26.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PartMan7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-31T10:03:11.000Z","updated_at":"2025-07-31T10:35:42.000Z","dependencies_parsed_at":"2025-07-31T12:25:17.429Z","dependency_job_id":"731414c6-e97e-4a7d-b66a-a8d95a23e08e","html_url":"https://github.com/PartMan7/generic-astar","commit_stats":null,"previous_names":["partman7/generic-astar"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/PartMan7/generic-astar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Fgeneric-astar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Fgeneric-astar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Fgeneric-astar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Fgeneric-astar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PartMan7","download_url":"https://codeload.github.com/PartMan7/generic-astar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Fgeneric-astar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273806120,"owners_count":25171564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-05T19:08:50.080Z","updated_at":"2025-09-05T19:08:54.140Z","avatar_url":"https://github.com/PartMan7.png","language":"TypeScript","readme":"# generic-astar\n\nGeneric JS/TS A\\* implementation. Comes with helper utils!\n\n## Installation\n\n```bash\n# Any of the following\nnpm install generic-astar\nyarn add generic-astar\nbun add generic-astar\n```\n\n## Usage\n\n#### TypeScript\n\n```ts\nimport AStar from 'generic-astar';\nimport { GridAdapter } from 'generic-astar/adapters';\n\nconst adapter = new GridAdapter(\n\t{ x: 5, y: 5 },\n\t{\n\t\tblocked: [[1, 1]],\n\t\ttarget: [[4, 4]],\n\t\tdiagonals: true,\n\t}\n);\n\nconst result = AStar({ from: [0, 0], adapter });\n```\n\n```ts\nimport AStar from 'generic-astar';\n\nconst result = AStar\u003c[number, number]\u003e({\n\tfrom: [0, 0],\n\tto: [[4, 4]],\n\thash: node =\u003e node.join(','),\n\theuristic: node =\u003e Math.sqrt((4 - node[0]) ** 2 + (4 - node[1]) ** 2),\n\tneighbors: node =\u003e {\n\t\tif (node[0] === 0 \u0026\u0026 node[1] === 0)\n\t\t\treturn [\n\t\t\t\t{ node: [3, 0], cost: 3 },\n\t\t\t\t{ node: [0, 2], cost: 2 },\n\t\t\t];\n\n\t\tif (node[0] === 4) return [{ node: [4, 4], cost: Math.abs(node[1] - 4) }];\n\n\t\treturn [{ node: [node[0] + 1, node[1] + 1], cost: Math.sqrt(2) }];\n\t},\n});\n\n// ({\n// \tdistance: 4 + 4 * SQRT2,\n// \tpath: [\n// \t\t[0, 0],\n// \t\t[0, 2],\n// \t\t[1, 3],\n// \t\t[2, 4],\n// \t\t[3, 5],\n// \t\t[4, 6],\n// \t\t[4, 4],\n// \t],\n// });\n```\n\n#### JavaScript (ESM)\n\n```js\nimport AStar from 'generic-astar';\n```\n\n#### JavaScript (CJS)\n\n```js\nconst AStar = require('generic-astar');\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartman7%2Fgeneric-astar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpartman7%2Fgeneric-astar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartman7%2Fgeneric-astar/lists"}