Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c90bb7c

Browse filesBrowse files
VoltrexKeyvadanielleadams
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 <duhamelantoine1995@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 46ed078 commit c90bb7c
Copy full SHA for c90bb7c

File tree

Expand file treeCollapse file tree

1 file changed

+2
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-6
lines changed
Open diff view settings
Collapse file

‎lib/internal/source_map/source_map.js‎

Copy file name to clipboardExpand all lines: lib/internal/source_map/source_map.js
+2-6Lines changed: 2 additions & 6 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.