blob: 76c649bcea5f23da5b15f4bb20112c181ad8e9d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
var _ = require('lodash');
exports.getLocation = function(message) {
var messageNode = message.node;
var location = {
line: message.line,
column: message.column,
};
var messageInput = _.get(messageNode, 'source.input');
if (!messageInput) return location;
var originLocation = messageInput.origin && messageInput.origin(message.line, message.column)
if (originLocation) return originLocation
location.file = messageInput.file || messageInput.id;
return location;
};
|