Socket
Socket
Sign inDemoInstall

text-direction

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-direction

Get the text direction from the browser.


Version published
Weekly downloads
47
increased by9.3%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 12 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc