UNPKG

rhombic

Version:

SQL parsing, lineage extraction and manipulation

37 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRange = void 0; /** * Returns the range of a token * * @param tokens */ const getRange = (tokens) => { if (Array.isArray(tokens)) { const { startLine, startColumn } = exports.getRange(tokens[0]); const { endLine, endColumn } = exports.getRange(tokens[tokens.length - 1]); return { startLine, startColumn, endLine, endColumn }; } const token = tokens; // Just rename for semantic if (token.startLine !== undefined && token.endLine !== undefined && token.startColumn !== undefined && token.endColumn !== undefined) { return { startLine: token.startLine, endLine: token.endLine, startColumn: token.startColumn, endColumn: token.endColumn // Checked in the runtime }; } else { throw new Error("Token is missing location information"); } }; exports.getRange = getRange; //# sourceMappingURL=getRange.js.map