{"name":"direction","version":"0.1.2","description":"Detect directionality: left-to-right, right-to-left, or neutral","license":"MIT","keywords":["writing","system","direction","directionality","rtl","ltr"],"repository":{"type":"git","url":"https://github.com/wooorm/direction.git"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com"},"devDependencies":{"istanbul":"^0.3.0","jscs":"^1.7.0","eslint":"^0.8.0","mocha":"^2.0.0"},"scripts":{"test":"_mocha --reporter spec --check-leaks -u exports test.js","test-travis":"istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --check-leaks -u exports test.js","lint":"npm run-script lint-api && npm run-script lint-test && npm run-script lint-style","lint-api":"eslint index.js --env node --env browser --rule 'quotes: [2, single]'","lint-test":"eslint test.js --env node --env mocha --rule 'quotes: [2, single]'","lint-style":"jscs index.js test.js --reporter=inline","coverage":"istanbul cover node_modules/.bin/_mocha -- -- test.js","make":"npm run-script lint && npm run-script coverage"},"gitHead":"774ca070ae502534b95bf4d917b4a7aa53d5657e","bugs":{"url":"https://github.com/wooorm/direction/issues"},"homepage":"https://github.com/wooorm/direction","_id":"direction@0.1.2","_shasum":"1238003094f785a5e8dfc283508ce9a63510a50e","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"dist":{"shasum":"1238003094f785a5e8dfc283508ce9a63510a50e","tarball":"http://registry-npm.ywwl.com/direction/download/direction-0.1.2.tgz","integrity":"sha512-JRrhPsas1cFx+RoMCrmOX9/z3+cnyZPWuC2STi/lkP6m/i0K5Q5qWrQL6Lg9pw1mn2vUuiiZigfWHXMbcu3qAg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICgH3+bjpWlEIwoJtSbl4OTSE04L22vjeX1K9ym2GDYJAiB9qxLcjs8FsQ5snU51yNW6Exn6pz3dcLK8rxYvJ/rVwA=="}],"size":2258,"noattachment":false,"key":"/direction/-/direction-0.1.2.tgz"},"directories":{},"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 12.20+, 14.14+, or 16.0+), install with [npm][]:\n\n```sh\nnpm install direction\n```\n\nIn Deno with [Skypack][]:\n\n```js\nimport {direction} from 'https://cdn.skypack.dev/direction@2?dts'\n```\n\nIn browsers with [Skypack][]:\n\n```html\n<script type=\"module\">\n  import {direction} from 'https://cdn.skypack.dev/direction@2?min'\n</script>\n```\n\n## Use\n\n```js\nimport {direction} from 'direction'\n\ndirection('A') // => 'ltr'\ndirection('anglais') // => 'ltr'\ndirection('بسيطة') // => 'rtl'\ndirection('@') // => 'neutral'\n```\n\n## API\n\nThis package exports the following identifier: `direction`.\nThere is no default export.\n\n### `direction(value)`\n\nDetect the direction of `value` (`string?`).\nReturns `'ltr'`, `'rtl'`, or `'neutral'`.\n\n## CLI\n\n```txt\nUsage: direction [options] <words...>\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][].\nThere are no extra exported 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 12.20+, 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<!-- Definitions -->\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[skypack]: https://www.skypack.dev\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","publish_time":1414261960537,"_cnpm_publish_time":1414261960537,"dist-tags":{"latest":"2.0.1"}}