@@ -201,18 +201,17 @@ function wrap(middleware, callback) {
201201 }
202202}
203203
204- var own$8 = {}.hasOwnProperty;
205204function stringifyPosition(value) {
206205 if (!value || typeof value !== 'object') {
207206 return ''
208207 }
209- if (own$8.call(value, 'position') || own$8.call( value, 'type') ) {
208+ if ('position' in value || 'type' in value ) {
210209 return position(value.position)
211210 }
212- if (own$8.call(value, 'start') || own$8.call( value, 'end') ) {
211+ if ('start' in value || 'end' in value ) {
213212 return position(value)
214213 }
215- if (own$8.call(value, 'line') || own$8.call( value, 'column') ) {
214+ if ('line' in value || 'column' in value ) {
216215 return point$1(value)
217216 }
218217 return ''
@@ -229,19 +228,18 @@ function index(value) {
229228
230229class VFileMessage extends Error {
231230 constructor(reason, place, origin) {
232- var parts = [null, null];
233- var position = {
231+ const parts = [null, null];
232+ let position = {
234233 start: {line: null, column: null},
235234 end: {line: null, column: null}
236235 };
237- var index;
238236 super();
239237 if (typeof place === 'string') {
240238 origin = place;
241- place = null ;
239+ place = undefined ;
242240 }
243241 if (typeof origin === 'string') {
244- index = origin.indexOf(':');
242+ const index = origin.indexOf(':');
245243 if (index === -1) {
246244 parts[1] = origin;
247245 } else {
@@ -21228,29 +21226,33 @@ function stringWidth(string, options = {}) {
2122821226 if (typeof string !== 'string' || string.length === 0) {
2122921227 return 0;
2123021228 }
21229+ options = {
21230+ ambiguousIsNarrow: true,
21231+ ...options
21232+ };
2123121233 string = stripAnsi(string);
2123221234 if (string.length === 0) {
2123321235 return 0;
2123421236 }
2123521237 string = string.replace(emojiRegex(), ' ');
21236- const ambiguousCharWidth = options.ambiguousIsNarrow ? 1 : 2;
21238+ const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
2123721239 let width = 0;
21238- for (let index = 0; index < string.length; index++ ) {
21239- const codePoint = string .codePointAt(index );
21240+ for (const character of string) {
21241+ const codePoint = character .codePointAt(0 );
2124021242 if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
2124121243 continue;
2124221244 }
2124321245 if (codePoint >= 0x300 && codePoint <= 0x36F) {
2124421246 continue;
2124521247 }
21246- const code = eastAsianWidth.eastAsianWidth(string.charAt(index) );
21248+ const code = eastAsianWidth.eastAsianWidth(character );
2124721249 switch (code) {
2124821250 case 'F':
2124921251 case 'W':
2125021252 width += 2;
2125121253 break;
2125221254 case 'A':
21253- width += ambiguousCharWidth ;
21255+ width += ambiguousCharacterWidth ;
2125421256 break;
2125521257 default:
2125621258 width += 1;
0 commit comments