Skip to content

mohsen1/string-direction

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

String Direction

A utility for getting direction of a string in JavaScript. String direction can be left-to-right, right-to-left or bi-directional.

Usage

#getDirection

var stringDirection = require('string-direction');

stringDirection.getDirection("Hello, world!"); // 'ltr'
stringDirection.getDirection("سلام دنیا"); // 'rtl'

#patch Patching String objects globally

By using patch() method a getDirection method will be exposed in String object.

require('string-direction').patch();

"Hello, world!".getDirection(); // "ltr"
"سلام دنیا".getDirection(); // "rtl"

Installation

String Direction works both in browser or NodeJS environment

Node

Install via NPM

npm install string-direction

Browser

Use script tag to include the library

Credits

This library is influenced by string-direction Ruby library by Marc Busqué

License

MIT

About

String Direction is a JavaScript library for detection of direction of `String` objects in JavaScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published