1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-10 04:23:53 +00:00
Files
browser/common/src/models/export/loginUri.ts
Oscar Hinton 1016bbfb9e Split jslib into multiple modules (#363)
* Split jslib into multiple modules
2021-06-03 18:58:57 +02:00

44 lines
1.1 KiB
TypeScript

import { UriMatchType } from '../../enums/uriMatchType';
import { LoginUriView } from '../view/loginUriView';
import { EncString } from '../domain/encString';
import { LoginUri as LoginUriDomain } from '../domain/loginUri';
export class LoginUri {
static template(): LoginUri {
const req = new LoginUri();
req.uri = 'https://google.com';
req.match = null;
return req;
}
static toView(req: LoginUri, view = new LoginUriView()) {
view.uri = req.uri;
view.match = req.match;
return view;
}
static toDomain(req: LoginUri, domain = new LoginUriDomain()) {
domain.uri = req.uri != null ? new EncString(req.uri) : null;
domain.match = req.match;
return domain;
}
uri: string;
match: UriMatchType = null;
constructor(o?: LoginUriView | LoginUriDomain) {
if (o == null) {
return;
}
if (o instanceof LoginUriView) {
this.uri = o.uri;
} else {
this.uri = o.uri?.encryptedString;
}
this.match = o.match;
}
}