diff options
Diffstat (limited to 'node_modules/postcss-reporter/lib/util.js')
| -rw-r--r-- | node_modules/postcss-reporter/lib/util.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/node_modules/postcss-reporter/lib/util.js b/node_modules/postcss-reporter/lib/util.js index 094b3acc..76c649bc 100644 --- a/node_modules/postcss-reporter/lib/util.js +++ b/node_modules/postcss-reporter/lib/util.js @@ -1,4 +1,6 @@ -exports.getLocation = function (message) { +var _ = require('lodash'); + +exports.getLocation = function(message) { var messageNode = message.node; var location = { @@ -6,13 +8,12 @@ exports.getLocation = function (message) { column: message.column, }; - var messageInput = messageNode && messageNode.source && messageNode.source.input; + var messageInput = _.get(messageNode, 'source.input'); if (!messageInput) return location; - var originLocation = - messageInput.origin && messageInput.origin(message.line, message.column); - if (originLocation) return originLocation; + var originLocation = messageInput.origin && messageInput.origin(message.line, message.column) + if (originLocation) return originLocation location.file = messageInput.file || messageInput.id; return location; |
