summaryrefslogtreecommitdiff
path: root/src/misc/cafy-id.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/cafy-id.ts')
-rw-r--r--src/misc/cafy-id.ts32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/misc/cafy-id.ts b/src/misc/cafy-id.ts
deleted file mode 100644
index 39886611e1..0000000000
--- a/src/misc/cafy-id.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { Context } from 'cafy';
-
-export class ID<Maybe = string> extends Context<string | (Maybe extends {} ? string : Maybe)> {
- public readonly name = 'ID';
-
- constructor(optional = false, nullable = false) {
- super(optional, nullable);
-
- this.push((v: any) => {
- if (typeof v !== 'string') {
- return new Error('must-be-an-id');
- }
- return true;
- });
- }
-
- public getType() {
- return super.getType('String');
- }
-
- public makeOptional(): ID<undefined> {
- return new ID(true, false);
- }
-
- public makeNullable(): ID<null> {
- return new ID(false, true);
- }
-
- public makeOptionalNullable(): ID<undefined | null> {
- return new ID(true, true);
- }
-}