summaryrefslogtreecommitdiff
path: root/node_modules/postcss-reporter/lib/util.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 16:27:06 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 16:27:06 +0800
commit2db6defc0b555d93d2363ba6c6dfa19df7dc7c11 (patch)
treea92c596973b150bbd1723b55facf38e0ab6258d8 /node_modules/postcss-reporter/lib/util.js
parent6dce4e2e8ed35a26af389b7ab388113381350444 (diff)
update
Diffstat (limited to 'node_modules/postcss-reporter/lib/util.js')
-rw-r--r--node_modules/postcss-reporter/lib/util.js11
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;