Package Exports
- string-direction
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-direction) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 object globally
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-directionBrowser
Use script tag to include the library
Credits
This library is influenced by string-direction Ruby library by Marc Busqué
License
MIT