{"version":3,"file":"position.mjs","names":[],"sources":["../../../src/errors/common/position.ts"],"sourcesContent":["type Position = Readonly<{\n    line: number;\n    column: number;\n}>;\n\nconst getPosition = (code: string, start: number): Position => {\n    const lines: string[] = code.slice(0, start).split(\"\\n\");\n\n    const lastLine: string | undefined = lines[lines.length - 1];\n\n    if (lastLine) {\n        return {\n            line: lines.length,\n            column: lastLine.length + 1,\n        };\n    }\n\n    return {\n        line: lines.length,\n        column: 0,\n    };\n};\n\nexport type { Position };\nexport { getPosition };\n"],"mappings":"AAKA,MAAM,eAAe,MAAc,UAA4B;CAC3D,MAAM,QAAkB,KAAK,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,IAAI;CAEvD,MAAM,WAA+B,MAAM,MAAM,SAAS;CAE1D,IAAI,UACA,OAAO;EACH,MAAM,MAAM;EACZ,QAAQ,SAAS,SAAS;CAC9B;CAGJ,OAAO;EACH,MAAM,MAAM;EACZ,QAAQ;CACZ;AACJ"}