BVB Source Codes

reactide Show ucs2length.js Source code

Return Download reactide: download ucs2length.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2.  
  3. // https://mathiasbynens.be/notes/javascript-encoding
  4. // https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
  5. module.exports = function ucs2length(str) {
  6.   var length = 0
  7.     , len = str.length
  8.     , pos = 0
  9.     , value;
  10.   while (pos < len) {
  11.     length++;
  12.     value = str.charCodeAt(pos++);
  13.     if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
  14.       // high surrogate, and there is a next character
  15.       value = str.charCodeAt(pos);
  16.       if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
  17.     }
  18.   }
  19.   return length;
  20. };
  21.  
downloaducs2length.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top