directionality

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

directionality

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

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

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

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

Access the regular expression of ltr charecters.

Access the regular expression of rtl charecters.

MIT