| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,6 @@ const { | |||
| 10 | 10 | FunctionPrototypeCall, | |
| 11 | 11 | Number, | |
| 12 | 12 | NumberIsFinite, | |
| 13 | - NumberIsInteger, | ||
| 14 | 13 | MathMin, | |
| 15 | 14 | MathRound, | |
| 16 | 15 | ObjectIs, | |
@@ -863,14 +862,8 @@ const getValidMode = hideStackFrames((mode, type) => { | |||
| 863 | 862 | if (mode == null) { | |
| 864 | 863 | return def; | |
| 865 | 864 | } | |
| 866 | - if (NumberIsInteger(mode) && mode >= min && mode <= max) { | ||
| 867 | - return mode; | ||
| 868 | - } | ||
| 869 | - if (typeof mode !== 'number') { | ||
| 870 | - throw new ERR_INVALID_ARG_TYPE('mode', 'integer', mode); | ||
| 871 | - } | ||
| 872 | - throw new ERR_OUT_OF_RANGE( | ||
| 873 | - 'mode', `an integer >= ${min} && <= ${max}`, mode); | ||
| 865 | + validateInteger(mode, 'mode', min, max); | ||
| 866 | + return mode; | ||
| 874 | 867 | }); | |
| 875 | 868 | ||
| 876 | 869 | const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -170,14 +170,12 @@ fs.accessSync(readWriteFile, mode); | |||
| 170 | 170 | () => fs.access(readWriteFile, mode, common.mustNotCall()), | |
| 171 | 171 | { | |
| 172 | 172 | code: 'ERR_INVALID_ARG_TYPE', | |
| 173 | - message: /"mode" argument.+integer/ | ||
| 174 | 173 | } | |
| 175 | 174 | ); | |
| 176 | 175 | assert.throws( | |
| 177 | 176 | () => fs.accessSync(readWriteFile, mode), | |
| 178 | 177 | { | |
| 179 | 178 | code: 'ERR_INVALID_ARG_TYPE', | |
| 180 | - message: /"mode" argument.+integer/ | ||
| 181 | 179 | } | |
| 182 | 180 | ); | |
| 183 | 181 | }); | |
@@ -194,14 +192,12 @@ fs.accessSync(readWriteFile, mode); | |||
| 194 | 192 | () => fs.access(readWriteFile, mode, common.mustNotCall()), | |
| 195 | 193 | { | |
| 196 | 194 | code: 'ERR_OUT_OF_RANGE', | |
| 197 | - message: /"mode".+It must be an integer >= 0 && <= 7/ | ||
| 198 | 195 | } | |
| 199 | 196 | ); | |
| 200 | 197 | assert.throws( | |
| 201 | 198 | () => fs.accessSync(readWriteFile, mode), | |
| 202 | 199 | { | |
| 203 | 200 | code: 'ERR_OUT_OF_RANGE', | |
| 204 | - message: /"mode".+It must be an integer >= 0 && <= 7/ | ||
| 205 | 201 | } | |
| 206 | 202 | ); | |
| 207 | 203 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -156,8 +156,6 @@ assert.throws(() => { | |||
| 156 | 156 | }, { | |
| 157 | 157 | code: 'ERR_OUT_OF_RANGE', | |
| 158 | 158 | name: 'RangeError', | |
| 159 | - message: 'The value of "mode" is out of range. It must be an integer ' + | ||
| 160 | - '>= 0 && <= 7. Received 8' | ||
| 161 | 159 | }); | |
| 162 | 160 | ||
| 163 | 161 | assert.throws(() => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -662,8 +662,7 @@ if (!common.isAIX) { | |||
| 662 | 662 | // Check copyFile with invalid modes. | |
| 663 | 663 | { | |
| 664 | 664 | const validateError = { | |
| 665 | - message: /"mode".+must be an integer >= 0 && <= 7\. Received -1/, | ||
| 666 | - code: 'ERR_OUT_OF_RANGE' | ||
| 665 | + code: 'ERR_OUT_OF_RANGE', | ||
| 667 | 666 | }; | |
| 668 | 667 | ||
| 669 | 668 | assert.throws( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,6 @@ async function validate() { | |||
| 14 | 14 | copyFile(fixtures.path('baz.js'), dest, 'r'), | |
| 15 | 15 | { | |
| 16 | 16 | code: 'ERR_INVALID_ARG_TYPE', | |
| 17 | - message: /mode.*integer.*string/ | ||
| 18 | 17 | } | |
| 19 | 18 | ); | |
| 20 | 19 | await copyFile(fixtures.path('baz.js'), dest); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,15 +64,13 @@ assert.strictEqual( | |||
| 64 | 64 | access(__filename, 8), | |
| 65 | 65 | { | |
| 66 | 66 | code: 'ERR_OUT_OF_RANGE', | |
| 67 | - message: /"mode".*must be an integer >= 0 && <= 7\. Received 8$/ | ||
| 68 | 67 | } | |
| 69 | 68 | ); | |
| 70 | 69 | ||
| 71 | 70 | assert.rejects( | |
| 72 | 71 | access(__filename, { [Symbol.toPrimitive]() { return 5; } }), | |
| 73 | 72 | { | |
| 74 | 73 | code: 'ERR_INVALID_ARG_TYPE', | |
| 75 | - message: /"mode" argument.+integer\. Received an instance of Object$/ | ||
| 76 | 74 | } | |
| 77 | 75 | ); | |
| 78 | 76 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments