{"id":17369792,"url":"https://github.com/juliuste/merge-simple-polygons","last_synced_at":"2025-04-08T03:34:51.417Z","repository":{"id":57294799,"uuid":"126926319","full_name":"juliuste/merge-simple-polygons","owner":"juliuste","description":"Merge two (adjacent) simple polygons into another simple polygon.","archived":false,"fork":false,"pushed_at":"2022-05-26T15:50:42.000Z","size":10,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-17T04:32:34.429Z","etag":null,"topics":["library"],"latest_commit_sha":null,"homepage":null,"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/juliuste.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":"2018-03-27T03:56:27.000Z","updated_at":"2023-03-15T12:52:22.000Z","dependencies_parsed_at":"2022-08-30T22:30:34.251Z","dependency_job_id":null,"html_url":"https://github.com/juliuste/merge-simple-polygons","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fmerge-simple-polygons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fmerge-simple-polygons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fmerge-simple-polygons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fmerge-simple-polygons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliuste","download_url":"https://codeload.github.com/juliuste/merge-simple-polygons/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223300865,"owners_count":17122702,"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":["library"],"created_at":"2024-10-16T00:13:58.334Z","updated_at":"2024-11-06T07:33:02.245Z","avatar_url":"https://github.com/juliuste.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# merge-simple-polygons\n\nMerge two (adjacent) simple polygons into another simple polygon.\n\n[![npm version](https://img.shields.io/npm/v/merge-simple-polygons.svg)](https://www.npmjs.com/package/merge-simple-polygons)\n[![License](https://img.shields.io/github/license/juliuste/merge-simple-polygons.svg?style=flat)](license)\n[![Contact me](https://img.shields.io/badge/contact-email-turquoise)](mailto:mail@juliustens.eu)\n\n## Installation\n\n```shell\nnpm install merge-simple-polygons\n```\n\n## Usage\n\n**This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).**\n\nThe module's default export is a function that takes two arrays of vertex names, each spanning a planar polygon and returns:\n\n- `false` if the given polygons share no vertices\n- `null` if there would be more than one resulting simple polygon (if the two given polygons share either exactly one vertex, which would result in two polygons *or* multiple egdes that are not connected, which would result in a polygon with a \"hole\")\n- a list of vertex IDs forming the merged polygon\n\n```js\nimport mergePolygons from 'merge-simple-polygons'\n\nconst polygonA = ['a', 'b', 'c', 'd', 'e']\nconst polygonB = ['e', 'a', 'g', 'h', 'i', 'd']\nconst polygonC = mergePolygons(polygonA, polygonB)\nconsole.log(polygonC) // ['a', 'b', 'c', 'd', 'i', 'h', 'g']\n\nconst polygonD = ['a', 'b', 'c']\nconst polygonE = ['d', 'e', 'f']\nconsole.log(mergePolygons(polygonD, polygonE)) // false\n\nconst polygonF = ['a', 'b', 'c', 'd', 'e']\nconst polygonG = ['a', 'b', 'f', 'e', 'd', 'g']\nconsole.log(mergePolygons(polygonF, polygonG)) // null\n```\n\n## Contributing\n\nIf you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/merge-simple-polygons/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fmerge-simple-polygons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliuste%2Fmerge-simple-polygons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fmerge-simple-polygons/lists"}