Socket
Book a DemoInstallSign in
Socket

directionality

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directionality

Determines the writing system's [directionality](http://en.wikipedia.org/wiki/Writing_system#Directionality) based on characters tests.

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

directionality

Determines the writing system's directionality based on characters tests.

Installation

$ component install component/directionality

Example

var dir = require('directionality');
dir('الولايات المتحدة الأمريكية'); // 'right'
dir('Hello world'); // 'left'

Method

The decision is made based on the first character of the input string.

API

directionality(str)

Returns 'rtl' for right-to-left text, and 'ltr' for left-to-right text.

directionality.regex.ltr

Access the regular expression of ltr charecters.

directionality.regex.rtl

Access the regular expression of rtl charecters.

License

MIT

FAQs

Package last updated on 15 Oct 2012

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