Node-Red configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict'
  2. class Warning {
  3. constructor(text, opts = {}) {
  4. this.type = 'warning'
  5. this.text = text
  6. if (opts.node && opts.node.source) {
  7. let range = opts.node.rangeBy(opts)
  8. this.line = range.start.line
  9. this.column = range.start.column
  10. this.endLine = range.end.line
  11. this.endColumn = range.end.column
  12. }
  13. for (let opt in opts) this[opt] = opts[opt]
  14. }
  15. toString() {
  16. if (this.node) {
  17. return this.node.error(this.text, {
  18. index: this.index,
  19. plugin: this.plugin,
  20. word: this.word
  21. }).message
  22. }
  23. if (this.plugin) {
  24. return this.plugin + ': ' + this.text
  25. }
  26. return this.text
  27. }
  28. }
  29. module.exports = Warning
  30. Warning.default = Warning