40 lines
716 B
TypeScript
40 lines
716 B
TypeScript
import { invariant } from "./errors"
|
|
|
|
export enum Category {
|
|
Login = 1,
|
|
CreditCard = 2,
|
|
SecureNote = 3,
|
|
Identity = 4,
|
|
Password = 5,
|
|
Tombstone = 99,
|
|
SoftwareLicense = 100,
|
|
BankAccount = 101,
|
|
Database = 102,
|
|
DriverLicense = 103,
|
|
OutdoorLicense = 104,
|
|
Membership = 105,
|
|
Passport = 106,
|
|
Rewards = 107,
|
|
SSN = 108,
|
|
Router = 109,
|
|
Server = 110,
|
|
Email = 111,
|
|
}
|
|
|
|
export enum FieldType {
|
|
Password = "P",
|
|
Text = "T",
|
|
Email = "E",
|
|
Number = "N",
|
|
Radio = "R",
|
|
Telephone = "TEL",
|
|
Checkbox = "C",
|
|
URL = "U",
|
|
}
|
|
|
|
export function getCategory(category: string) {
|
|
const int = parseInt(category)
|
|
invariant(int in Category, `Invalid category: ${category}`)
|
|
return int as Category
|
|
}
|