lib: refactor to use validateObject()
validator
Use the `validateObject()` validator in source maps where appropriate. PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
224b78ff06
commit
4712472c0f
@ -75,9 +75,7 @@ const {
|
||||
StringPrototypeCharAt,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
ERR_INVALID_ARG_TYPE
|
||||
} = require('internal/errors').codes;
|
||||
const { validateObject } = require('internal/validators');
|
||||
|
||||
let base64Map;
|
||||
|
||||
@ -317,9 +315,7 @@ function decodeVLQ(stringCharIterator) {
|
||||
* @return {SourceMapV3}
|
||||
*/
|
||||
function cloneSourceMapV3(payload) {
|
||||
if (typeof payload !== 'object') {
|
||||
throw new ERR_INVALID_ARG_TYPE('payload', ['Object'], payload);
|
||||
}
|
||||
validateObject(payload, 'payload');
|
||||
payload = { ...payload };
|
||||
for (const key in payload) {
|
||||
if (ObjectPrototypeHasOwnProperty(payload, key) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user