| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cf0eabc commit a73279c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ const { | |||
| 10 | 10 | ObjectDefineProperty, | |
| 11 | 11 | ObjectGetPrototypeOf, | |
| 12 | 12 | ObjectPrototypeHasOwnProperty, | |
| 13 | + SafeSet, | ||
| 13 | 14 | String, | |
| 14 | 15 | StringPrototypeRepeat, | |
| 15 | 16 | StringPrototypeSlice, | |
@@ -42,7 +43,10 @@ const kReadableOperator = { | |||
| 42 | 43 | const kMaxShortStringLength = 12; | |
| 43 | 44 | const kMaxLongStringLength = 512; | |
| 44 | 45 | ||
| 45 | - const kMethodsWithCustomMessageDiff = ['deepStrictEqual', 'strictEqual', 'partialDeepStrictEqual']; | ||
| 46 | + const kMethodsWithCustomMessageDiff = new SafeSet() | ||
| 47 | + .add('deepStrictEqual') | ||
| 48 | + .add('strictEqual') | ||
| 49 | + .add('partialDeepStrictEqual'); | ||
| 46 | 50 | ||
| 47 | 51 | function copyError(source) { | |
| 48 | 52 | const target = ObjectAssign( | |
@@ -263,7 +267,7 @@ class AssertionError extends Error { | |||
| 263 | 267 | if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; | |
| 264 | 268 | ||
| 265 | 269 | if (message != null) { | |
| 266 | - if (kMethodsWithCustomMessageDiff.includes(operator)) { | ||
| 270 | + if (kMethodsWithCustomMessageDiff.has(operator)) { | ||
| 267 | 271 | super(createErrDiff(actual, expected, operator, message, diff)); | |
| 268 | 272 | } else { | |
| 269 | 273 | super(String(message)); | |
@@ -283,7 +287,7 @@ class AssertionError extends Error { | |||
| 283 | 287 | expected = copyError(expected); | |
| 284 | 288 | } | |
| 285 | 289 | ||
| 286 | - if (kMethodsWithCustomMessageDiff.includes(operator)) { | ||
| 290 | + if (kMethodsWithCustomMessageDiff.has(operator)) { | ||
| 287 | 291 | super(createErrDiff(actual, expected, operator, message, diff)); | |
| 288 | 292 | } else if (operator === 'notDeepStrictEqual' || | |
| 289 | 293 | operator === 'notStrictEqual') { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments