Skip to content

Commit 10f17f2

Browse files
committed
Remove runtime type checks
1 parent fcfd3a3 commit 10f17f2

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

‎src/index.ts‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ export interface Credentials {
2525
*/
2626

2727
export function parse(string: string): Credentials | undefined {
28-
if (typeof string !== 'string') {
29-
return undefined;
30-
}
31-
3228
// parse header
3329
const match = CREDENTIALS_REGEXP.exec(string);
3430
if (!match) return undefined;
@@ -52,23 +48,6 @@ export function parse(string: string): Credentials | undefined {
5248
* @public
5349
*/
5450
export function format(credentials: Credentials): string {
55-
if (!credentials) {
56-
throw new TypeError('argument credentials is required');
57-
}
58-
59-
if (typeof credentials !== 'object') {
60-
throw new TypeError('argument credentials is required to be an object');
61-
}
62-
63-
if (
64-
typeof credentials.name !== 'string' ||
65-
typeof credentials.pass !== 'string'
66-
) {
67-
throw new TypeError(
68-
'argument credentials is required to have name and pass properties',
69-
);
70-
}
71-
7251
if (
7352
credentials.name.includes(':') || // RFC 7617 disallows colon in username
7453
CONTROL_CHARS_REGEXP.test(credentials.name)

0 commit comments

Comments
 (0)