| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 821b9ac commit 51d8fbf
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -813,7 +813,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) { | |||
| 813 | 813 | return `${braces[0]}]`; | |
| 814 | 814 | // Special handle the value. The original value is required below. The | |
| 815 | 815 | // bound function is required to reconstruct missing information. | |
| 816 | - formatter = formatTypedArray.bind(null, bound); | ||
| 816 | + formatter = formatTypedArray.bind(null, bound, size); | ||
| 817 | 817 | extrasType = kArrayExtrasType; | |
| 818 | 818 | } else if (isMapIterator(value)) { | |
| 819 | 819 | keys = getKeys(value, ctx.showHidden); | |
@@ -1389,8 +1389,8 @@ function formatArray(ctx, value, recurseTimes) { | |||
| 1389 | 1389 | return output; | |
| 1390 | 1390 | } | |
| 1391 | 1391 | ||
| 1392 | - function formatTypedArray(value, ctx, ignored, recurseTimes) { | ||
| 1393 | - const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), value.length); | ||
| 1392 | + function formatTypedArray(value, length, ctx, ignored, recurseTimes) { | ||
| 1393 | + const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length); | ||
| 1394 | 1394 | const remaining = value.length - maxLength; | |
| 1395 | 1395 | const output = new Array(maxLength); | |
| 1396 | 1396 | const elementFormatter = value.length > 0 && typeof value[0] === 'number' ? | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -311,6 +311,12 @@ assert(!/Object/.test( | |||
| 311 | 311 | ); | |
| 312 | 312 | }); | |
| 313 | 313 | ||
| 314 | + { | ||
| 315 | + const brokenLength = new Float32Array(2); | ||
| 316 | + Object.defineProperty(brokenLength, 'length', { value: -1 }); | ||
| 317 | + assert.strictEqual(inspect(brokenLength), 'Float32Array(2) [ 0n, 0n ]'); | ||
| 318 | + } | ||
| 319 | + | ||
| 314 | 320 | assert.strictEqual( | |
| 315 | 321 | util.inspect(Object.create({}, { | |
| 316 | 322 | visible: { value: 1, enumerable: true }, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments