Skip to content

Commit 38c850b

Browse files
committed
Remove CredentialsImpl
1 parent 56e1e4a commit 38c850b

2 files changed

Lines changed: 5 additions & 15 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"dist/"
1919
],
2020
"scripts": {
21+
"bench": "vitest bench",
2122
"build": "ts-scripts build",
2223
"format": "ts-scripts format",
2324
"lint": "ts-scripts lint",

src/index.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ export function parse(string: string): Credentials | undefined {
3838
const colonIndex = userPass.indexOf(':');
3939
if (colonIndex === -1) return undefined;
4040

41-
// return credentials object
42-
return new CredentialsImpl(
43-
userPass.slice(0, colonIndex),
44-
userPass.slice(colonIndex + 1),
45-
);
41+
return {
42+
name: userPass.slice(0, colonIndex),
43+
pass: userPass.slice(colonIndex + 1),
44+
};
4645
}
4746

4847
/**
@@ -65,13 +64,3 @@ const CREDENTIALS_REGEXP =
6564
function decodeBase64(str: string): string {
6665
return Buffer.from(str, 'base64').toString();
6766
}
68-
69-
class CredentialsImpl implements Credentials {
70-
name: string;
71-
pass: string;
72-
73-
constructor(name: string, pass: string) {
74-
this.name = name;
75-
this.pass = pass;
76-
}
77-
}

0 commit comments

Comments
 (0)