index.js
function getCharAt (index) {
    var code = this.charCodeAt(index);

    // BMP
    if (code < 0xD800 || code > 0xDFFF) {
        return String.fromCharCode(code);
    }

    // high surrogate
    if (code < 0xDC00) {
        // access the low surrogate
        var nextCode = this.charCodeAt(index + 1);
        if (isNaN(nextCode)) return false;
        if (nextCode < 0xDC00 || nextCode > 0xDFFF) return false;

        return String.fromCharCode(code, nextCode);
    } else {
        // low surrogate
        return false;
    }
}
function getCharAt (index) {
    var code = this.charCodeAt(index);

    // BMP
    if (code < 0xD800 || code > 0xDFFF) {
        return String.fromCharCode(code);
    }

    // high surrogate
    if (code < 0xDC00) {
        // access the low surrogate
        var nextCode = this.charCodeAt(index + 1);
        if (isNaN(nextCode)) return false;
        if (nextCode < 0xDC00 || nextCode > 0xDFFF) return false;

        return String.fromCharCode(code, nextCode);
    } else {
        // low surrogate
        return false;
    }
}
function getCharAt ( index ) { var code = this . charCodeAt ( index ) ; // BMP if ( code < 0xD800 || code > 0xDFFF ) { return String . fromCharCode ( code ) ; } // high surrogate if ( code < 0xDC00 ) { // access the low surrogate var nextCode = this . charCodeAt ( index + 1 ) ; if ( isNaN ( nextCode ) ) return false ; if ( nextCode < 0xDC00 || nextCode > 0xDFFF ) return false ; return String . fromCharCode ( code , nextCode ) ; } else { // low surrogate return false ; } }
no bound checking return false when unknown character or iterating at the low surrogate
no bound checking return false when unknown character or iterating at the low surrogate