mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-02 11:58:12 +03:00
Add PATCH /users/:userID endpoint
This commit is contained in:
@@ -75,4 +75,24 @@ export function IsString(val: unknown): val is string {
|
||||
|
||||
export function DedupeArr<T>(arr: T[]): T[] {
|
||||
return [...new Set(arr)];
|
||||
}
|
||||
}
|
||||
|
||||
export function StripUrl(url: string, userInput: string | null) {
|
||||
if (!userInput) {
|
||||
return userInput;
|
||||
}
|
||||
|
||||
if (userInput.toLowerCase().includes(url)) {
|
||||
return userInput.split(url)[1];
|
||||
}
|
||||
|
||||
return userInput;
|
||||
}
|
||||
|
||||
export function DeleteUndefinedProps(record: any) {
|
||||
for (const key in record) {
|
||||
if (record[key] === undefined) {
|
||||
delete record[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,3 +11,5 @@ export function FormatPrError(err: PrudenceError, foreword = "Error") {
|
||||
}
|
||||
|
||||
export const optNull = (v: ValidSchemaValue) => p.optional(p.nullable(v));
|
||||
|
||||
export const optNullFluffStrField = optNull(p.isBoundedString(3, 140));
|
||||
|
||||
Reference in New Issue
Block a user