{"id":41825032,"url":"https://github.com/pirtwo/griddedjs","last_synced_at":"2026-01-25T08:08:31.619Z","repository":{"id":57254110,"uuid":"285985355","full_name":"pirtwo/griddedjs","owner":"pirtwo","description":"small library for working with 2D arrays.","archived":false,"fork":false,"pushed_at":"2020-08-16T05:13:36.000Z","size":130,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T04:56:32.429Z","etag":null,"topics":["2d","2d-array","grid","grid2d"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pirtwo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-08T06:13:21.000Z","updated_at":"2022-01-21T15:32:10.000Z","dependencies_parsed_at":"2022-09-04T13:10:51.254Z","dependency_job_id":null,"html_url":"https://github.com/pirtwo/griddedjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/pirtwo/griddedjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirtwo%2Fgriddedjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirtwo%2Fgriddedjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirtwo%2Fgriddedjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirtwo%2Fgriddedjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pirtwo","download_url":"https://codeload.github.com/pirtwo/griddedjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirtwo%2Fgriddedjs/sbom","scorecard":{"id":735382,"data":{"date":"2025-08-11","repo":{"name":"github.com/pirtwo/griddedjs","commit":"41d0b1f9dd7eccabc1e45861637ec29212844741"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T15:38:11.948Z","repository_id":57254110,"created_at":"2025-08-22T15:38:11.948Z","updated_at":"2025-08-22T15:38:11.948Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28748573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T07:58:02.558Z","status":"ssl_error","status_checked_at":"2026-01-25T07:57:57.153Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["2d","2d-array","grid","grid2d"],"created_at":"2026-01-25T08:08:31.173Z","updated_at":"2026-01-25T08:08:31.609Z","avatar_url":"https://github.com/pirtwo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gridded.js\n[![Build Status](https://travis-ci.com/pirtwo/griddedjs.svg?branch=master)](https://travis-ci.com/pirtwo/griddedjs)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/pirtwo/griddedjs/issues)\n[![](https://img.shields.io/github/license/pirtwo/griddedjs)](https://github.com/pirtwo/griddedjs/blob/master/LICENSE)\n\n\n### 2D grid library for JavaScript\nThe aim of this library is to make working with 2D arrays easier. With the help of this library, you can easily create a grid structure and store or retrieve your data with ease in that context.\n\n### install\n```\nnpm i --save griddedjs\n```\n\n### Usage\n**important**: This library exports the Cell2D class for wrapping cell data, all values should be wrapped with Cell2D class before adding to the Grid2D.\u003cbr/\u003e\n**important**: All indexes starts from 0.\n\n```javascript\nimport { Grid2D, Cell2D } from 'griddedjs';\n\n// Grid2D(x, y)\n// create a grid with 2 rows and 3 columns\nconst grid = new Grid2D(3, 2);\n\n// fill with value\ngrid.fill(1);\n\n// fill with array\ngrid.fill([ 1, 2, 3, 4, 5, 6]); \n\n// fill with callback function\ngrid.fill(() =\u003e Math.random());\n\n// fill with custom method\ngrid.cells = new Array(6).fill(undefined).map(i =\u003e new Cell2D(grid, Math.random()));\n\nlet rows = [...grid.getY()];\nlet cols = [...grid.getX()];\n\n// iterate through cells\nfor (cell in grid) {\n    // get or set cell value\n    cell.value *= 2;\n    \n    // get cell position in grid {x, y}\n    cell.position();\n\n    // get cell index in the grid.cells array\n    cell.index();\n\n    // get all neighbor of cell\n    cell.neighbor().forEach(i =\u003e { \n        // do stuff with neighbor\n    });\n    \n    // get all adjacent of cell\n    cell.adjacent().forEach(i =\u003e { \n        // do stuff with adjacent\n    });\n}\n\n// iterate through grid rows\nfor (row in grid.getY()) {\n    // do stuff with rows\n}\n\n// iterate through grid cols\nfor (col in grid.getX()) {\n    // do stuff with columns\n}\n\n// add new row\ngrid.insertY(3).forEach(cell =\u003e {\n    // do stuff with new cells\n});\n\n// add new column\ngrid.insertX(3).forEach(newCell =\u003e {\n    // do stuff with new cells\n});\n\n// delete row\ngrid.deleteY(3);\n\n// delete column\ngrid.deleteX(3);\n```\n\n### Grid2D methods\n#### constructor(x, y)\nThis method takes two integer numbers ( x \u003e 0 and y \u003e 0) as dimensions of the grid and fills it with cells (class Cell2D). The initial value of each cell is undefined.\n```\n            X\n    ________________\n    |(x0,y0)|(x1,y0)|\n Y  |(x0,y1)|(x1,y1)|\n    |(x0,y2)|(x1,y2)|\n    ________________\n```\n\n#### getX()\nGenerator function, lets us iterate through the columns of the grid (x0, x1, x2, ...).\n```javascript\nlet column0 = [...grid.getX()][0];\n\nfor (col in grid.getX()) {\n    // do stuff\n}\n```\n\n#### getY()\nGenerator function, lets us iterate through the rows of the grid (y0, y1, y2, ...).\n```javascript\nlet row0 = [...grid.getY()][0];\n\nfor (row in grid.getY()) {\n    // do stuff\n}\n```\n\n#### fill(value)\nThis method fills the grid with provided value, the value could be a primitive or array. Provided values will be wrapped by class Cell2D. Also, you can provide a callback function that will be called for each cell and the returned value from the function will be used as cell value.\n```javascript\nlet grid = new Grid2D(2, 2);\ngrid.fill(0);                   // fill with value\ngrid,fill([0, 0, 1, 1]          // fill with array\ngrid.fill(() =\u003e {               // fill with callback function\n    return { price: 2.99 }\n});\n\n```\n\n#### cell(x, y)\nReturns the cell (class Cell2D) at position x and y.\n```javascript\nlet grid = new Grid2D(2, 2);\nlet cell = grid.cell(0, 1);\n```\n\n#### insertX(index)\nThis method will insert a new column at the parameter index. New cells will be initialized with undefined value and will be returned as an array.\n```javascript\nlet grid = new Grid2D(2, 5);    // create grid with 5 row and 2 column\nlet newCol = grid.insertX(3);   // insert new column to the end\n\n```\n\n#### insertY(index)\nThis method will insert a new row at the parameter index. New cells will be initialized with undefined value and will be returned as an array.\n```javascript\nlet grid = new Grid2D(2, 2);    // create grid with 5 row and 2 column\nlet newRow = grid.insertY(1);   // insert new row between row-0 and row-2\n```\n\n#### deleteX(index)\nThis method deletes the column[index] of the grid.\n```javascript\nlet grid = new Grid2D(2, 2);\ngrid.deleteX(0);                // deletes first column of grid\n```\n\n#### deleteY(index)\nThis method deletes the row[index] of the grid.\n```javascript\nlet grid = new Grid2D(2, 2);\ngrid.deleteY(0);                // deletes first row of grid\n```\n\n\n### Cell2D methods\n#### constructor(grid, value = undefined)\nThis class is a wrapper for the cell value. The first parameter is the related grid that this cell belongs to, the second parameter is the value of the cell.\n\n#### index()\nReturns the index of the cell (all cells in Grid2D class will be stored in an array).\n```javascript\nlet grid = new Grid2D(2, 2);\nlet cell = [...grid][3];\ncell.index();                   //result will be 3\n```\n\n#### position()\nReturns the position of the cell in the grid {x, y}.\n```javascript\nlet grid = new Grid2D(2, 2);\nlet {x, y} = grid.cell(1, 1).position();  // result will be x = 1 and y = 1\n```\n\n#### adjacent()\nReturns the adjacent of the cell as an array.\n```javascript\nlet grid = new Grid2D(3, 3);\ngrid.cell(1, 1).adjacent().forEach(i =\u003e {\n    // do stuff\n});\n```\n```\n            X\n    _________________________\n    |       | adj-1 |       |\n Y  | adj-2 |(x1,y1)| adj-3 |\n    |       | adj-4 |       |\n    _________________________\n```\n\n#### neighbor()\nReturns the neighbors of the cell as an array.\n```javascript\nlet grid = new Grid2D(3, 3);\ngrid.cell(1, 1).neighbor().forEach(i =\u003e {\n    // do stuff\n});\n```\n```\n            X\n    _________________________\n    | nei-1 | nei-2 | nei-3 |\n Y  | nei-4 |(x1,y1)| nei-5 |\n    | nei-6 | nei-7 | nei-8 |\n    _________________________\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirtwo%2Fgriddedjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirtwo%2Fgriddedjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirtwo%2Fgriddedjs/lists"}