Security update for Core, with self-updated composer
[yaffs-website] / node_modules / uncss / node_modules / postcss / lib / warning.js
1 'use strict';
2
3 exports.__esModule = true;
4
5 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
7 var Warning = function () {
8     function Warning(text) {
9         var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
10
11         _classCallCheck(this, Warning);
12
13         this.type = 'warning';
14
15         this.text = text;
16
17         if (opts.node && opts.node.source) {
18             var pos = opts.node.positionBy(opts);
19             this.line = pos.line;
20             this.column = pos.column;
21         }
22
23         for (var opt in opts) {
24             this[opt] = opts[opt];
25         }
26     }
27
28     Warning.prototype.toString = function toString() {
29         if (this.node) {
30             return this.node.error(this.text, {
31                 plugin: this.plugin,
32                 index: this.index,
33                 word: this.word
34             }).message;
35         } else if (this.plugin) {
36             return this.plugin + ': ' + this.text;
37         } else {
38             return this.text;
39         }
40     };
41
42     return Warning;
43 }();
44
45 exports.default = Warning;
46 module.exports = exports['default'];