'use strict';
module.exports = function ucs2length(str) {
var length = 0
, len = str.length
, pos = 0
, value;
while (pos < len) {
length++;
value = str.charCodeAt(pos++);
if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
value = str.charCodeAt(pos);
if ((value & 0xFC00) == 0xDC00) pos++;
}
}
return length;
};