cookie-jar,cookie,index: consistent spacing
errors: fix paramError function
This commit is contained in:
parent
2271c2e055
commit
425067e759
|
@ -6,7 +6,7 @@ export class CookieParseError extends Error {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function paramError(position, paramName, functionName, validTypes) {
|
export function paramError(position, paramName, functionName, validTypes) {
|
||||||
validTypes = [validTypes].flatMap(t => "\"" + t + "\"");
|
validTypes = [validTypes].flat().map(t => "\"" + t + "\"");
|
||||||
validTypes = validTypes.slice(0, -1).join(", ") + (validTypes.length > 1 ? " or " : "") + validTypes.slice(-1);
|
validTypes = validTypes.slice(0, -1).join(", ") + (validTypes.length > 1 ? " or " : "") + validTypes.slice(-1);
|
||||||
return new TypeError(`${position} parameter "${paramName}" passed to "${functionName}" is not of type ${validTypes}!`);
|
return new TypeError(`${position} parameter "${paramName}" passed to "${functionName}" is not of type ${validTypes}!`);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user