{"id":15413471,"url":"https://github.com/wooorm/direction","last_synced_at":"2025-04-12T15:35:54.601Z","repository":{"id":57741948,"uuid":"20828839","full_name":"wooorm/direction","owner":"wooorm","description":"Detect directionality: left-to-right, right-to-left, or neutral","archived":false,"fork":false,"pushed_at":"2024-10-25T11:13:35.000Z","size":112,"stargazers_count":43,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-03T15:09:47.380Z","etag":null,"topics":["direction","directionality","ltr","rtl"],"latest_commit_sha":null,"homepage":"https://wooorm.com/direction/","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/wooorm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":"funding.yml","license":"license","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},"funding":{"github":"wooorm"}},"created_at":"2014-06-14T09:13:04.000Z","updated_at":"2024-12-02T08:37:25.000Z","dependencies_parsed_at":"2024-11-16T04:15:35.979Z","dependency_job_id":null,"html_url":"https://github.com/wooorm/direction","commit_stats":{"total_commits":122,"total_committers":2,"mean_commits":61.0,"dds":"0.040983606557377095","last_synced_commit":"2318ba66f91ced488253441d9abdcf1748bee1f3"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fdirection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fdirection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fdirection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fdirection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wooorm","download_url":"https://codeload.github.com/wooorm/direction/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590203,"owners_count":21129766,"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":["direction","directionality","ltr","rtl"],"created_at":"2024-10-01T16:57:15.071Z","updated_at":"2025-04-12T15:35:54.576Z","avatar_url":"https://github.com/wooorm.png","language":"JavaScript","funding_links":["https://github.com/sponsors/wooorm"],"categories":[],"sub_categories":[],"readme":"# direction\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nDetect the direction of text: left-to-right, right-to-left, or neutral.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`direction(value)`](#directionvalue)\n*   [CLI](#cli)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package detects whether text is written left-to-right or right-to-left.\n\n## When should I use this?\n\nThis is a simple and fast algorithm.\nIt looks at the first strong left-to-right or right-to-left character (for\nexample, the letter `a` is LTR, the letter `ى` is RTL).\nThat’s often enough but might be too naïve as it doesn’t take percentages or so\ninto account.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 14.14+, 16.0+), install with [npm][]:\n\n```sh\nnpm install direction\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {direction} from 'https://esm.sh/direction@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {direction} from 'https://esm.sh/direction@2?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {direction} from 'direction'\n\ndirection('A') // =\u003e 'ltr'\ndirection('anglais') // =\u003e 'ltr'\ndirection('بسيطة') // =\u003e 'rtl'\ndirection('@') // =\u003e 'neutral'\n```\n\n## API\n\nThis package exports the identifier `direction`.\nThere is no default export.\n\n### `direction(value)`\n\nGet the direction from a given value.\n\n###### `value`\n\nValue to check (`string`, required).\n\n##### Returns\n\nDirection for `value` (`'ltr'`, `'rtl'`, or `'neutral'`).\n\n## CLI\n\n```txt\nUsage: direction [options] \u003cwords...\u003e\n\nDetect the direction of text: left-to-right, right-to-left, or neutral\n\nOptions:\n\n  -h, --help           output usage information\n  -v, --version        output version number\n\nUsage:\n\n# output directionality\n$ direction @\n# neutral\n\n# output directionality from stdin\n$ echo 'الانجليزية' | direction\n# rtl\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nThis package is at least compatible with all maintained versions of Node.js.\nAs of now, that is Node.js 14.14+ and 16.0+.\nIt also works in Deno and modern browsers.\n\n## Security\n\nThis package is safe.\n\n## Contribute\n\nYes please!\nSee [How to Contribute to Open Source][contribute].\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/wooorm/direction/workflows/main/badge.svg\n\n[build]: https://github.com/wooorm/direction/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/direction.svg\n\n[coverage]: https://codecov.io/github/wooorm/direction\n\n[downloads-badge]: https://img.shields.io/npm/dm/direction.svg\n\n[downloads]: https://www.npmjs.com/package/direction\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/direction.svg\n\n[size]: https://bundlephobia.com/result?p=direction\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[contribute]: https://opensource.guide/how-to-contribute/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fdirection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwooorm%2Fdirection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fdirection/lists"}