This repository has been archived on 2021-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
simpledash/bulma/node_modules/postcss-reporter/lib/util.js

21 lines
498 B
JavaScript
Raw Permalink Normal View History

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;
};