demo/typescript.js
function getCompletionEntryDisplayName(name, target, performCharacterChecks) {
            if (!name) {
                return undefined;
            }
            name = ts.stripQuotes(name);
            if (!name) {
                return undefined;
            }
            // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
            // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name.
            // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid.
            // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name.
            if (performCharacterChecks) {
                if (!ts.isIdentifierStart(name.charCodeAt(0), target)) {
                    return undefined;
                }
                for (var i = 1, n = name.length; i < n; i++) {
                    if (!ts.isIdentifierPart(name.charCodeAt(i), target)) {
                        return undefined;
                    }
                }
            }
            return name;
        }
function getCompletionEntryDisplayName(name, target, performCharacterChecks) {
            if (!name) {
                return undefined;
            }
            name = ts.stripQuotes(name);
            if (!name) {
                return undefined;
            }
            // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
            // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name.
            // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid.
            // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name.
            if (performCharacterChecks) {
                if (!ts.isIdentifierStart(name.charCodeAt(0), target)) {
                    return undefined;
                }
                for (var i = 1, n = name.length; i < n; i++) {
                    if (!ts.isIdentifierPart(name.charCodeAt(i), target)) {
                        return undefined;
                    }
                }
            }
            return name;
        }
Get a displayName from a given for completion list, performing any necessary quotes stripping
and checking whether the name is valid identifier name.