src/language/JSUtils.js
function findAllMatchingFunctionsInText(text, searchName) {
        var allFunctions = _findAllFunctionsInText(text);
        var result = [];
        var lines = text.split("\n");

        _.forEach(allFunctions, function (functions, functionName) {
            if (functionName === searchName || searchName === "*") {
                functions.forEach(function (funcEntry) {
                    var endOffset = _getFunctionEndOffset(text, funcEntry.offsetStart);
                    result.push({
                        name: functionName,
                        label: funcEntry.label,
                        lineStart: StringUtils.offsetToLineNum(lines, funcEntry.offsetStart),
                        lineEnd: StringUtils.offsetToLineNum(lines, endOffset),
                        nameLineStart: funcEntry.location.start.line - 1,
                        nameLineEnd: funcEntry.location.end.line - 1,
                        columnStart: funcEntry.location.start.column,
                        columnEnd: funcEntry.location.end.column
                    });
                });
            }
        });

        return result;
    }
function findAllMatchingFunctionsInText(text, searchName) {
        var allFunctions = _findAllFunctionsInText(text);
        var result = [];
        var lines = text.split("\n");

        _.forEach(allFunctions, function (functions, functionName) {
            if (functionName === searchName || searchName === "*") {
                functions.forEach(function (funcEntry) {
                    var endOffset = _getFunctionEndOffset(text, funcEntry.offsetStart);
                    result.push({
                        name: functionName,
                        label: funcEntry.label,
                        lineStart: StringUtils.offsetToLineNum(lines, funcEntry.offsetStart),
                        lineEnd: StringUtils.offsetToLineNum(lines, endOffset),
                        nameLineStart: funcEntry.location.start.line - 1,
                        nameLineEnd: funcEntry.location.end.line - 1,
                        columnStart: funcEntry.location.start.column,
                        columnEnd: funcEntry.location.end.column
                    });
                });
            }
        });

        return result;
    }
function findAllMatchingFunctionsInText ( text , searchName ) { var allFunctions = _findAllFunctionsInText ( text ) ; var result = [ ] ; var lines = text . split ( "\n" ) ; _ . forEach ( allFunctions , function ( functions , functionName ) { if ( functionName === searchName || searchName === "*" ) { functions . forEach ( function ( funcEntry ) { var endOffset = _getFunctionEndOffset ( text , funcEntry . offsetStart ) ; result . push ( { name : functionName , label : funcEntry . label , lineStart : StringUtils . offsetToLineNum ( lines , funcEntry . offsetStart ) , lineEnd : StringUtils . offsetToLineNum ( lines , endOffset ) , nameLineStart : funcEntry . location . start . line - 1 , nameLineEnd : funcEntry . location . end . line - 1 , columnStart : funcEntry . location . start . column , columnEnd : funcEntry . location . end . column } ) ; } ) ; } } ) ; return result ; }
Finds all instances of the specified searchName in "text".
Returns an Array of Objects with start and end properties.

@param text {!String} JS text to search
@param searchName {!String} function name to search for
@return {Array.<{offset:number, functionName:string}>}
Array of objects containing the start offset for each matched function name.
Finds all instances of the specified searchName in text . Returns an Array of Objects with start and end properties .