I just wrote this tiny library called isRTL.coffee to determine the direction of the text. Is there any better way of doing this?rtlChars = '\u0600-\u06FF' # Arabic - RangertlChars += '\u0750-\u077F' # Arabic Supplement - RangertlChars += '\uFB50-\uFDFF' # Arabic Presentation Forms-A - RangertlChars += '\uFE70-\uFEFF' # Arabic Presentation Forms-B - RangereRTL = new RegExp ^[#{rtlChars}]window.isRTL = (value) ->    if value.match reRTL        true    else        false
isRTL.coffee library to determine if a text is of right-to-left direction
javascript;performance;coffeescript;i18n;unicode
Yep, it's possible to improve. You can simply do:window.isRTL = (value) ->    reRTL.test valueAnother way to improve is the way you declare your special characters. Right now, it's confusing between the = and +=. Here is another way:rtlChars = [    '\u0600-\u06FF' # Arabic - Range    '\u0750-\u077F' # Arabic Supplement - Range    '\uFB50-\uFDFF' # Arabic Presentation Forms-A - Range    '\uFE70-\uFEFF' # Arabic Presentation Forms-B - Range].join()reRTL = new RegExp ^[#{rtlChars}]This way, adding a new character is simply adding a line in an array.