| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1d74143 commit 44256bb
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -960,7 +960,7 @@ const win32 = { | |||
| 960 | 960 | format: function format(pathObject) { | |
| 961 | 961 | if (pathObject === null || typeof pathObject !== 'object') { | |
| 962 | 962 | throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'pathObject', 'Object', | |
| 963 | - typeof pathObject); | ||
| 963 | + pathObject); | ||
| 964 | 964 | } | |
| 965 | 965 | return _format('\\', pathObject); | |
| 966 | 966 | }, | |
@@ -1503,7 +1503,7 @@ const posix = { | |||
| 1503 | 1503 | format: function format(pathObject) { | |
| 1504 | 1504 | if (pathObject === null || typeof pathObject !== 'object') { | |
| 1505 | 1505 | throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'pathObject', 'Object', | |
| 1506 | - typeof pathObject); | ||
| 1506 | + pathObject); | ||
| 1507 | 1507 | } | |
| 1508 | 1508 | return _format('/', pathObject); | |
| 1509 | 1509 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -207,4 +207,19 @@ function checkFormat(path, testCases) { | |||
| 207 | 207 | testCases.forEach(function(testCase) { | |
| 208 | 208 | assert.strictEqual(path.format(testCase[0]), testCase[1]); | |
| 209 | 209 | }); | |
| 210 | + | ||
| 211 | + function typeName(value) { | ||
| 212 | + return value === null ? 'null' : typeof value; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + [null, undefined, 1, true, false, 'string'].forEach((pathObject) => { | ||
| 216 | + assert.throws(() => { | ||
| 217 | + path.format(pathObject); | ||
| 218 | + }, common.expectsError({ | ||
| 219 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 220 | + type: TypeError, | ||
| 221 | + message: 'The "pathObject" argument must be of type Object. Received ' + | ||
| 222 | + 'type ' + typeName(pathObject) | ||
| 223 | + })); | ||
| 224 | + }); | ||
| 210 | 225 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments