{"id":16986144,"url":"https://github.com/konradlinkowski/grafjs","last_synced_at":"2026-05-20T14:45:02.125Z","repository":{"id":57253007,"uuid":"139769113","full_name":"KonradLinkowski/GrafJS","owner":"KonradLinkowski","description":"2D graph for chunk-based games","archived":false,"fork":false,"pushed_at":"2018-07-10T17:47:00.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T00:07:56.783Z","etag":null,"topics":["2d","board","chunk","chunks","game","games","graph","map","nodes"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/grafjs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KonradLinkowski.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}},"created_at":"2018-07-04T21:59:16.000Z","updated_at":"2020-09-24T17:31:22.000Z","dependencies_parsed_at":"2022-08-31T22:20:10.435Z","dependency_job_id":null,"html_url":"https://github.com/KonradLinkowski/GrafJS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KonradLinkowski%2FGrafJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KonradLinkowski%2FGrafJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KonradLinkowski%2FGrafJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KonradLinkowski%2FGrafJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KonradLinkowski","download_url":"https://codeload.github.com/KonradLinkowski/GrafJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244894307,"owners_count":20527669,"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","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":["2d","board","chunk","chunks","game","games","graph","map","nodes"],"created_at":"2024-10-14T02:44:55.124Z","updated_at":"2026-05-20T14:45:02.081Z","avatar_url":"https://github.com/KonradLinkowski.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GrafJS\n[![NPM Downloads](https://img.shields.io/npm/dw/grafjs.svg)](https://npmjs.org/package/grafjs)\n[![Build Status](https://travis-ci.org/KonradLinkowski/GrafJS.svg?branch=dev)](https://travis-ci.org/KonradLinkowski/GrafJS)\n[![Dependency Status](https://david-dm.org/KonradLinkowski/GrafJS.svg)](https://david-dm.org/KonradLinkowski/GrafJS)\n[![devDependency Status](https://david-dm.org/KonradLinkowski/GrafJS/dev-status.svg)](https://david-dm.org/KonradLinkowski/GrafJS#info=devDependencies)\n[![Known Vulnerabilities](https://snyk.io/test/github/KonradLinkowski/GrafJS/badge.svg?targetFile=package.json)](https://snyk.io/test/github/KonradLinkowski/GrafJS?targetFile=package.json)\n[![Maintainability](https://api.codeclimate.com/v1/badges/f2916fbf643afc357ef7/maintainability)](https://codeclimate.com/github/KonradLinkowski/GrafJS/maintainability)\n## Features\n2D graph for chunk-based games.\n- No dependencies\n- Easy to use\n- Lightweight\n## Installing\n```bash\n$ npm install grafjs\n```\n## Example\nImport\n```js\nconst Graf = require('grafjs')\n```\nCreating a board where each chunk is 20 x 20.\n```js\n// creates 20 x 20 grid filled with 0's\nconst grid = new Array(20).fill(null).map(a =\u003e new Array(20).fill(0))\n// creates the board with a default value for each chunk\nconst board = new Graf(grid)\n// adds examplary chunk\nboard.addChunk(0, 0)\n```\nGetting specified chunk and adjacent chunks.\n```js\n// returns chunk at position (1, 3)\nconst chunk = board.getChunk(1, 3)\nconst left = chunk.getLeft()\nconst right = chunk.getRight()\nconst up = chunk.getUp()\nconst down = chunk.getDown()\n```\nGetting and setting chunk's content.\n```js\n// gets value\nconst content = chunk.getValue()\n// sets value\nchunk.setValue([1])\n```\nRemoving a chunk\n```js\n// removes the chunk at (3, 4)\nboard.removeChunk(3, 4)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonradlinkowski%2Fgrafjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonradlinkowski%2Fgrafjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonradlinkowski%2Fgrafjs/lists"}