NewsBlur/node/node_modules/string-direction
2020-06-15 18:45:05 -04:00
..
jasmine-lib/jasmine-1.3.1 Upgrading node and npm as well as all packages. 2019-04-13 14:44:10 -04:00
.npmignore Upgrading node and npm as well as all packages. 2019-04-13 14:44:10 -04:00
index.js Upgrading node and npm as well as all packages. 2019-04-13 14:44:10 -04:00
package.json I don't know why mercury parser is being so persnickity but it is. 2020-06-15 18:45:05 -04:00
README.md Upgrading node and npm as well as all packages. 2019-04-13 14:44:10 -04:00
SpecRunner.html Upgrading node and npm as well as all packages. 2019-04-13 14:44:10 -04:00
string-direction-spec.js Upgrading node and npm as well as all packages. 2019-04-13 14:44:10 -04:00

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