This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 1,000,000+ packages pre-installed, including
string-direction with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
var stringDirection = require('string-direction'); stringDirection.getDirection("Hello, world!"); // 'ltr' stringDirection.getDirection("سلام دنیا"); // 'rtl'
#patchPatching String objects globally
patch() method a
getDirection method will be exposed in
require('string-direction').patch(); "Hello, world!".getDirection(); // "ltr" "سلام دنیا".getDirection(); // "rtl"
String Direction works both in browser or NodeJS environment
Install via NPM
npm install string-direction
script tag to include the library
This library is influenced by string-direction Ruby library by Marc Busqué