mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
26 lines
577 B
JavaScript
26 lines
577 B
JavaScript
'use strict';
|
|
|
|
var path = require('path');
|
|
|
|
function getRelativePath(absolutePath) {
|
|
if (typeof window === 'undefined') {
|
|
absolutePath = path.resolve(process.cwd(), absolutePath);
|
|
return path.relative(process.cwd(), absolutePath);
|
|
} else {
|
|
return absolutePath;
|
|
}
|
|
}
|
|
|
|
class PosInfo {
|
|
constructor(path, line, column) {
|
|
this.path = getRelativePath(path);
|
|
this.line = line;
|
|
this.column = column;
|
|
}
|
|
|
|
toString() {
|
|
return this.path + ":" + this.line + ":" + this.column;
|
|
}
|
|
}
|
|
|
|
module.exports = PosInfo; |