mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
20 lines
486 B
JavaScript
20 lines
486 B
JavaScript
export default class Warning {
|
|
constructor(text, opts = { }) {
|
|
this.type = 'warning';
|
|
this.text = text;
|
|
for ( let opt in opts ) {
|
|
this[opt] = opts[opt];
|
|
}
|
|
}
|
|
|
|
toString() {
|
|
if ( this.node ) {
|
|
return this.node.error(this.text, { plugin: this.plugin }).message;
|
|
} else if ( this.plugin ) {
|
|
return this.plugin + ': ' + this.text;
|
|
} else {
|
|
return this.text;
|
|
}
|
|
}
|
|
}
|