lib/ucs2.js
function ucs2encode(array) {
  return _.map(array, function (value) {
    var output = '';

    if (value > 0xFFFF) {
      value -= 0x10000;
      output += String.fromCharCode(value >>> 10 & 0x3FF | 0xD800);
      value = 0xDC00 | value & 0x3FF;
    }
    output += String.fromCharCode(value);
    return output;
  }).join('');
}
function ucs2encode(array) {
  return _.map(array, function (value) {
    var output = '';

    if (value > 0xFFFF) {
      value -= 0x10000;
      output += String.fromCharCode(value >>> 10 & 0x3FF | 0xD800);
      value = 0xDC00 | value & 0x3FF;
    }
    output += String.fromCharCode(value);
    return output;
  }).join('');
}
function ucs2encode ( array ) { return _ . map ( array , function ( value ) { var output = '' ; if ( value > 0xFFFF ) { value -= 0x10000 ; output += String . fromCharCode ( value >>> 10 & 0x3FF | 0xD800 ) ; value = 0xDC00 | value & 0x3FF ; } output += String . fromCharCode ( value ) ; return output ; } ) . join ( '' ) ; }
Taken from the punycode library
Taken from the punycode library