diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
| commit | efbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch) | |
| tree | 2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/postcss-reporter/lib/util.js | |
| parent | 43acceb75957c880a5ba5a31aae221394a36d5f6 (diff) | |
node fixes, updates
Diffstat (limited to 'node_modules/postcss-reporter/lib/util.js')
| -rw-r--r-- | node_modules/postcss-reporter/lib/util.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/node_modules/postcss-reporter/lib/util.js b/node_modules/postcss-reporter/lib/util.js index 76c649bc..54334913 100644 --- a/node_modules/postcss-reporter/lib/util.js +++ b/node_modules/postcss-reporter/lib/util.js @@ -1,6 +1,9 @@ -var _ = require('lodash'); +var supportsLargeCharset = + process.platform !== 'win32' || + process.env.CI || + process.env.TERM === 'xterm-256color'; -exports.getLocation = function(message) { +exports.getLocation = function (message) { var messageNode = message.node; var location = { @@ -8,13 +11,21 @@ exports.getLocation = function(message) { column: message.column, }; - var messageInput = _.get(messageNode, 'source.input'); + var messageInput = messageNode && messageNode.source && 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; }; + +exports.plur = function plur(word, count) { + return (count === 1 ? word : `${word}s`); +} + +exports.warningSymbol = supportsLargeCharset ? '⚠' : '!!'; +exports.errorSymbol = supportsLargeCharset ? '✖' : 'xx'; |
