cookie-jar,cookie,index: consistent spacing

errors: fix paramError function
This commit is contained in:
jkhsjdhjs 2019-11-25 23:14:34 +01:00
parent 2271c2e055
commit 425067e759
Signed by: jkhsjdhjs
GPG Key ID: BAC6ADBAB7D576CC
4 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ export class CookieParseError extends Error {
};
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);
return new TypeError(`${position} parameter "${paramName}" passed to "${functionName}" is not of type ${validTypes}!`);
};