Skip to content

Commit 59a15e8

Browse files
VoltrexKeyvaruyadorno
authored andcommitted
lib: refactor to use validateObject() validator
Use the `validateObject()` validator in source maps where appropriate. PR-URL: #41845 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Zijian Liu <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 07b6bf4 commit 59a15e8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/internal/source_map/source_map.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ const {
7575
StringPrototypeCharAt,
7676
} = primordials;
7777

78-
const {
79-
ERR_INVALID_ARG_TYPE
80-
} = require('internal/errors').codes;
78+
const { validateObject } = require('internal/validators');
8179

8280
let base64Map;
8381

@@ -317,9 +315,7 @@ function decodeVLQ(stringCharIterator) {
317315
* @return {SourceMapV3}
318316
*/
319317
function cloneSourceMapV3(payload) {
320-
if (typeof payload !== 'object') {
321-
throw new ERR_INVALID_ARG_TYPE('payload', ['Object'], payload);
322-
}
318+
validateObject(payload, 'payload');
323319
payload = { ...payload };
324320
for (const key in payload) {
325321
if (ObjectPrototypeHasOwnProperty(payload, key) &&

0 commit comments

Comments
 (0)