@@ -258,17 +258,20 @@ class VFileMessage extends Error { |
258 | 258 | } |
259 | 259 | this.name = stringifyPosition(place) || '1:1'; |
260 | 260 | this.message = typeof reason === 'object' ? reason.message : reason; |
261 | | - this.stack = typeof reason === 'object' ? reason.stack : ''; |
| 261 | + this.stack = ''; |
| 262 | + if (typeof reason === 'object' && reason.stack) { |
| 263 | + this.stack = reason.stack; |
| 264 | + } |
262 | 265 | this.reason = this.message; |
263 | 266 | this.fatal; |
264 | 267 | this.line = position.start.line; |
265 | 268 | this.column = position.start.column; |
| 269 | + this.position = position; |
266 | 270 | this.source = parts[0]; |
267 | 271 | this.ruleId = parts[1]; |
268 | | - this.position = position; |
| 272 | + this.file; |
269 | 273 | this.actual; |
270 | 274 | this.expected; |
271 | | - this.file; |
272 | 275 | this.url; |
273 | 276 | this.note; |
274 | 277 | } |
@@ -7770,17 +7773,18 @@ function remarkParse(options) { |
7770 | 7773 | Object.assign(this, {Parser: parser}); |
7771 | 7774 | } |
7772 | 7775 |
|
7773 | | -var own$4 = {}.hasOwnProperty; |
| 7776 | +const own$4 = {}.hasOwnProperty; |
7774 | 7777 | function zwitch(key, options) { |
7775 | | - var settings = options || {}; |
7776 | | - function one(value) { |
7777 | | - var fn = one.invalid; |
7778 | | - var handlers = one.handlers; |
| 7778 | + const settings = options || {}; |
| 7779 | + function one(value, ...parameters) { |
| 7780 | + let fn = one.invalid; |
| 7781 | + const handlers = one.handlers; |
7779 | 7782 | if (value && own$4.call(value, key)) { |
7780 | | - fn = own$4.call(handlers, value[key]) ? handlers[value[key]] : one.unknown; |
| 7783 | + const id = String(value[key]); |
| 7784 | + fn = own$4.call(handlers, id) ? handlers[id] : one.unknown; |
7781 | 7785 | } |
7782 | 7786 | if (fn) { |
7783 | | - return fn.apply(this, arguments) |
| 7787 | + return fn.call(this, value, ...parameters) |
7784 | 7788 | } |
7785 | 7789 | } |
7786 | 7790 | one.handlers = settings.handlers || {}; |
@@ -7948,14 +7952,14 @@ function hardBreak(_, _1, context, safe) { |
7948 | 7952 | return '\\\n' |
7949 | 7953 | } |
7950 | 7954 |
|
7951 | | -function longestStreak(value, character) { |
| 7955 | +function longestStreak(value, substring) { |
7952 | 7956 | const source = String(value); |
7953 | | - let index = source.indexOf(character); |
| 7957 | + let index = source.indexOf(substring); |
7954 | 7958 | let expected = index; |
7955 | 7959 | let count = 0; |
7956 | 7960 | let max = 0; |
7957 | | - if (typeof character !== 'string' || character.length !== 1) { |
7958 | | - throw new Error('Expected character') |
| 7961 | + if (typeof substring !== 'string') { |
| 7962 | + throw new TypeError('Expected substring') |
7959 | 7963 | } |
7960 | 7964 | while (index !== -1) { |
7961 | 7965 | if (index === expected) { |
@@ -7965,8 +7969,8 @@ function longestStreak(value, character) { |
7965 | 7969 | } else { |
7966 | 7970 | count = 1; |
7967 | 7971 | } |
7968 | | - expected = index + 1; |
7969 | | - index = source.indexOf(character, expected); |
| 7972 | + expected = index + substring.length; |
| 7973 | + index = source.indexOf(substring, expected); |
7970 | 7974 | } |
7971 | 7975 | return max |
7972 | 7976 | } |
|