lib/rules/prefer-template.js
function getTextBetween(node1, node2) {
            const allTokens = [node1].concat(sourceCode.getTokensBetween(node1, node2)).concat(node2);
            const sourceText = sourceCode.getText();

            return allTokens.slice(0, -1).reduce((accumulator, token, index) => accumulator + sourceText.slice(token.range[1], allTokens[index + 1].range[0]), "");
        }
function getTextBetween(node1, node2) {
            const allTokens = [node1].concat(sourceCode.getTokensBetween(node1, node2)).concat(node2);
            const sourceText = sourceCode.getText();

            return allTokens.slice(0, -1).reduce((accumulator, token, index) => accumulator + sourceText.slice(token.range[1], allTokens[index + 1].range[0]), "");
        }
function getTextBetween ( node1 , node2 ) { const allTokens = [ node1 ] . concat ( sourceCode . getTokensBetween ( node1 , node2 ) ) . concat ( node2 ) ; const sourceText = sourceCode . getText ( ) ; return allTokens . slice ( 0 , - 1 ) . reduce ( ( accumulator , token , index ) => accumulator + sourceText . slice ( token . range [ 1 ] , allTokens [ index + 1 ] . range [ 0 ] ) , "" ) ; }
Gets the non-token text between two nodes, ignoring any other tokens that appear between the two tokens.
@param {ASTNode} node1 The first node
@param {ASTNode} node2 The second node
@returns {string} The text between the nodes, excluding other tokens
Gets the non - token text between two nodes ignoring any other tokens that appear between the two tokens .