{"id":28382245,"url":"https://github.com/phun-ky/cardinal","last_synced_at":"2026-03-10T11:12:30.034Z","repository":{"id":291168039,"uuid":"976822975","full_name":"phun-ky/cardinal","owner":"phun-ky","description":"A set of JavaScript functions that gives you the cardinal direction based on degrees","archived":false,"fork":false,"pushed_at":"2025-06-24T07:00:04.000Z","size":1131,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T07:00:06.896Z","etag":null,"topics":["cardinal","cardinal-direction","cardinal-directions","cartesian","compass","degree","degrees","direction"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/phun-ky.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"phun-ky"}},"created_at":"2025-05-02T20:18:54.000Z","updated_at":"2025-06-24T06:59:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"44aa2448-d7e5-4b83-8d03-7534bb0d1b19","html_url":"https://github.com/phun-ky/cardinal","commit_stats":null,"previous_names":["phun-ky/cardinal"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/phun-ky/cardinal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fcardinal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fcardinal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fcardinal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fcardinal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phun-ky","download_url":"https://codeload.github.com/phun-ky/cardinal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fcardinal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261805043,"owners_count":23212290,"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":["cardinal","cardinal-direction","cardinal-directions","cartesian","compass","degree","degrees","direction"],"created_at":"2025-05-30T04:07:11.115Z","updated_at":"2026-02-24T09:13:07.467Z","avatar_url":"https://github.com/phun-ky.png","language":"TypeScript","readme":"# @phun-ky/cardinal\n\n![Cardinal: A set of JavaScript functions that gives you the cardinal direction based on degrees](./public/cardinal-logo-small.png)\n\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](http://makeapullrequest.com) [![SemVer 2.0](https://img.shields.io/badge/SemVer-2.0-green.svg)](http://semver.org/spec/v2.0.0.html) ![npm version](https://img.shields.io/npm/v/@phun-ky/cardinal) ![issues](https://img.shields.io/github/issues/phun-ky/cardinal) ![license](https://img.shields.io/npm/l/@phun-ky/cardinal) ![size](https://img.shields.io/bundlephobia/min/@phun-ky/cardinal) ![npm](https://img.shields.io/npm/dm/%40phun-ky/cardinal) ![GitHub Repo stars](https://img.shields.io/github/stars/phun-ky/cardinal) [![codecov](https://codecov.io/gh/phun-ky/cardinal/graph/badge.svg?token=VA91DL7ZLZ)](https://codecov.io/gh/phun-ky/cardinal) [![build](https://github.com/phun-ky/cardinal/actions/workflows/check.yml/badge.svg)](https://github.com/phun-ky/cardinal/actions/workflows/check.yml)\n\n## About\n\nA set of JavaScript functions that gives you the cardinal direction based on degrees.\n\n## Table of Contents\u003c!-- omit from toc --\u003e\n\n- [@phun-ky/cardinal](#phun-kycardinal)\n  - [About](#about)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [API](#api)\n    - [cardinalDirection()](#cardinaldirection)\n      - [Parameters](#parameters)\n      - [Returns](#returns)\n      - [Throws](#throws)\n      - [Throws](#throws-1)\n      - [Example](#example)\n    - [cardinalDirectionCrude()](#cardinaldirectioncrude)\n      - [Parameters](#parameters-1)\n      - [Returns](#returns-1)\n      - [Throws](#throws-2)\n      - [Throws](#throws-3)\n      - [Example](#example-1)\n    - [cardinalDirectionDetailed()](#cardinaldirectiondetailed)\n      - [Parameters](#parameters-2)\n      - [Returns](#returns-2)\n      - [Throws](#throws-4)\n      - [Throws](#throws-5)\n      - [Example](#example-2)\n  - [Contributing](#contributing)\n  - [License](#license)\n  - [Changelog](#changelog)\n  - [Sponsor me](#sponsor-me)\n  - [Attributions](#attributions)\n\n## Installation\n\n```shell-session\nnpm i --save @phun-ky/cardinal\n```\n\n## Usage\n\nWith the default function:\n\n```ts\nimport { cardinalDirection } from '@phun-ky/cardinal';\n\nconst direction = cardinalDirection(45);\nconsole.log(direction); // south-east\n```\n\nOr with the crude function:\n\n```ts\nimport { cardinalDirectionCrude } from '@phun-ky/cardinal';\n\nconst direction = cardinalDirectionCrude(45);\nconsole.log(direction); // south\n```\n\nOr with the detailed function:\n\n```ts\nimport { cardinalDirectionDetailed } from '@phun-ky/cardinal';\n\nconst direction = cardinalDirectionDetailed(56.25);\nconsole.log(direction); // south-south-east\n```\n\n## API\n\n### cardinalDirection()\n\n```ts\nfunction cardinalDirection(degrees): CardinalDirectionType;\n```\n\nDefined in: [main.ts:93](https://github.com/phun-ky/cardinal/blob/main/src/main.ts#L93)\n\nReturns the 8-point cardinal direction based on degrees.\nNote: 0 degrees is EAST, increasing clockwise.\n\n#### Parameters\n\n| Parameter | Type     | Description           |\n| --------- | -------- | --------------------- |\n| `degrees` | `number` | The angle in degrees. |\n\n#### Returns\n\n[`CardinalDirectionType`](#cardinaldirectiontype)\n\n- The 8-point cardinal direction.\n\n#### Throws\n\nParameter cannot exceed 360.\n\n#### Throws\n\nParameter cannot be lower than 0.\n\n#### Example\n\n```ts\nconst direction = cardinalDirection(135); // \"south\"\n```\n\n---\n\n### cardinalDirectionCrude()\n\n```ts\nfunction cardinalDirectionCrude(degrees): CardinalDirectionCrudeType;\n```\n\nDefined in: [main.ts:127](https://github.com/phun-ky/cardinal/blob/main/src/main.ts#L127)\n\nReturns the crude 4-point cardinal direction based on degrees.\nNote: 0 degrees is EAST, increasing clockwise.\n\n#### Parameters\n\n| Parameter | Type     | Description           |\n| --------- | -------- | --------------------- |\n| `degrees` | `number` | The angle in degrees. |\n\n#### Returns\n\n[`CardinalDirectionCrudeType`](#cardinaldirectioncrudetype)\n\n- The 4-point cardinal direction.\n\n#### Throws\n\nParameter cannot exceed 360.\n\n#### Throws\n\nParameter cannot be lower than 0.\n\n#### Example\n\n```ts\nconst direction = cardinalDirectionCrude(200); // \"west\"\n```\n\n---\n\n### cardinalDirectionDetailed()\n\n```ts\nfunction cardinalDirectionDetailed(degrees): CardinalDirectionDetailedType;\n```\n\nDefined in: [main.ts:49](https://github.com/phun-ky/cardinal/blob/main/src/main.ts#L49)\n\nReturns the detailed 16-point cardinal direction based on degrees.\nNote: 0 degrees is EAST, increasing clockwise.\n\n#### Parameters\n\n| Parameter | Type     | Description           |\n| --------- | -------- | --------------------- |\n| `degrees` | `number` | The angle in degrees. |\n\n#### Returns\n\n[`CardinalDirectionDetailedType`](#cardinaldirectiondetailedtype)\n\n- The 16-point cardinal direction.\n\n#### Throws\n\nParameter cannot exceed 360.\n\n#### Throws\n\nParameter cannot be lower than 0.\n\n#### Example\n\n```ts\nconst direction = cardinalDirectionDetailed(101.25); // \"south-south-east\"\n```\n\n## Contributing\n\nWant to contribute? Please read the [CONTRIBUTING.md](https://github.com/phun-ky/cardinal/blob/main/CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](https://github.com/phun-ky/cardinal/blob/main/CODE_OF_CONDUCT.md)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/phun-ky/cardinal/blob/main/LICENSE) file for details.\n\n## Changelog\n\nSee the [CHANGELOG.md](https://github.com/phun-ky/cardinal/blob/main/CHANGELOG.md) for details on the latest updates.\n\n## Sponsor me\n\nI'm an Open Source evangelist, creating stuff that does not exist yet to help get rid of secondary activities and to enhance systems already in place, be it documentation or web sites.\n\nThe sponsorship is an unique opportunity to alleviate more hours for me to maintain my projects, create new ones and contribute to the large community we're all part of :)\n\n[Support me on GitHub Sponsors](https://github.com/sponsors/phun-ky).\n\np.s. **Ukraine is still under brutal Russian invasion. A lot of Ukrainian people are hurt, without shelter and need help**. You can help in various ways, for instance, directly helping refugees, spreading awareness, putting pressure on your local government or companies. You can also support Ukraine by donating e.g. to [Red Cross](https://www.icrc.org/en/donate/ukraine), [Ukraine humanitarian organisation](https://savelife.in.ua/en/donate-en/#donate-army-card-weekly) or [donate Ambulances for Ukraine](https://www.gofundme.com/f/help-to-save-the-lives-of-civilians-in-a-war-zone).\n\n## Attributions\n\nCompass by Justicon from \u003ca href=\"https://thenounproject.com/browse/icons/term/compass/\" target=\"_blank\" title=\"Compass Icons\"\u003eNoun Project\u003c/a\u003e (CC BY 3.0)\n","funding_links":["https://github.com/sponsors/phun-ky"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphun-ky%2Fcardinal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphun-ky%2Fcardinal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphun-ky%2Fcardinal/lists"}