55[ ![ Downloads] [ downloads-badge ]] [ downloads ]
66[ ![ Size] [ size-badge ]] [ size ]
77
8- Detect direction: left-to-right, right-to-left, or neutral.
8+ Detect the direction of text: left-to-right, right-to-left, or neutral.
9+
10+ ## Contents
11+
12+ * [ What is this?] ( #what-is-this )
13+ * [ When should I use this?] ( #when-should-i-use-this )
14+ * [ Install] ( #install )
15+ * [ Use] ( #use )
16+ * [ API] ( #api )
17+ * [ ` direction(value) ` ] ( #directionvalue )
18+ * [ CLI] ( #cli )
19+ * [ Types] ( #types )
20+ * [ Compatibility] ( #compatibility )
21+ * [ Security] ( #security )
22+ * [ Contribute] ( #contribute )
23+ * [ License] ( #license )
24+
25+ ## What is this?
26+
27+ This package detects whether text is written left-to-right or right-to-left.
28+
29+ ## When should I use this?
30+
31+ This is a simple and fast algorithm.
32+ It looks at the first strong left-to-right or right-to-left character (for
33+ example, the letter ` a ` is LTR, the letter ` ى ` is RTL).
34+ That’s often enough but might be too naïve as it doesn’t take percentages or so
35+ into account.
936
1037## Install
1138
12- This package is ESM only: Node 12+ is needed to use it and it must be ` import ` ed
13- instead of ` require ` d.
39+ This package is [ ESM only] [ esm ] .
40+ In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm ] [ ] :
1441
1542``` sh
1643npm install direction
1744```
1845
46+ In Deno with [ Skypack] [ ] :
47+
48+ ``` js
49+ import {direction } from ' https://cdn.skypack.dev/direction@2?dts'
50+ ```
51+
52+ In browsers with [ Skypack] [ ] :
53+
54+ ``` html
55+ <script type =" module" >
56+ import {direction } from ' https://cdn.skypack.dev/direction@2?min'
57+ </script >
58+ ```
59+
1960## Use
2061
2162``` js
@@ -29,7 +70,7 @@ direction('@') // => 'neutral'
2970
3071## API
3172
32- This package exports the following identifiers : ` direction ` .
73+ This package exports the following identifier : ` direction ` .
3374There is no default export.
3475
3576### ` direction(value) `
@@ -42,7 +83,7 @@ Returns `'ltr'`, `'rtl'`, or `'neutral'`.
4283``` txt
4384Usage: direction [options] <words...>
4485
45- Detect directionality : left-to-right, right-to-left, or neutral
86+ Detect the direction of text : left-to-right, right-to-left, or neutral
4687
4788Options:
4889
@@ -60,6 +101,26 @@ $ echo 'الانجليزية' | direction
60101# rtl
61102```
62103
104+ ## Types
105+
106+ This package is fully typed with [ TypeScript] [ ] .
107+ There are no extra exported types.
108+
109+ ## Compatibility
110+
111+ This package is at least compatible with all maintained versions of Node.js.
112+ As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
113+ It also works in Deno and modern browsers.
114+
115+ ## Security
116+
117+ This package is safe.
118+
119+ ## Contribute
120+
121+ Yes please!
122+ See [ How to Contribute to Open Source] [ contribute ] .
123+
63124## License
64125
65126[ MIT] [ license ] © [ Titus Wormer] [ author ]
@@ -82,6 +143,16 @@ $ echo 'الانجليزية' | direction
82143
83144[ size ] : https://bundlephobia.com/result?p=direction
84145
146+ [ npm ] : https://docs.npmjs.com/cli/install
147+
148+ [ skypack ] : https://www.skypack.dev
149+
85150[ license ] : license
86151
87152[ author ] : https://wooorm.com
153+
154+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
155+
156+ [ typescript ] : https://www.typescriptlang.org
157+
158+ [ contribute ] : https://opensource.guide/how-to-contribute/
0 commit comments