string-direction

0.1.2 • Public • Published

String Direction

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

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    39,956
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    39,956
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i string-direction

Weekly Downloads

39,956

Version

0.1.2

License

MIT

Last publish

Collaborators

  • mohsen