text-direction

2.0.1 • Public • Published

text-direction

NPM Version Package Size

Get the text direction from an element node.

Installation

npm install text-direction

Usage

    import textDirection from "text-direction";
    // Or using a CDN without installation
    import textDirection from "https://unpkg.com/text-direction";

Then, you can start to use it on your code :

    const nodeDirection = textDirection(myNode); // With a node as argument for its specific direction
    const globalDirection = textDirection(); // Without argument to target <body>

Returned value are :

  • "ltr" if direction is right-to-left
  • "rtl" if direction is left-to-right
  • "" if the element specified has no style (not attached to a DOM)

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i text-direction

Weekly Downloads

37

Version

2.0.1

License

MIT

Unpacked Size

3.77 kB

Total Files

4

Last publish

Collaborators

  • gmartigny