diff options
author | bobzel <zzzman@gmail.com> | 2025-02-14 14:07:18 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-02-14 14:07:18 -0500 |
commit | c079b7aa916d7eb35ce186806ca312c84e910cb2 (patch) | |
tree | ec3ab972671d54b31639c8f357bde4ae372b0d2a /src/fields/Types.ts | |
parent | 4a9d8bf9e09a25faeba41c7ece46b86548d66847 (diff) |
major restructure of GPTPopup so that it works with all collections.
Diffstat (limited to 'src/fields/Types.ts')
-rw-r--r-- | src/fields/Types.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fields/Types.ts b/src/fields/Types.ts index e19673665..474882959 100644 --- a/src/fields/Types.ts +++ b/src/fields/Types.ts @@ -134,6 +134,10 @@ export function PDFCast(field: FieldResult, defaultVal: PdfField | null = null) export function ImageCast(field: FieldResult, defaultVal: ImageField | null = null) { return Cast(field, ImageField, defaultVal); } +export function ImageCastWithSuffix(field: FieldResult, suffix: string, defaultVal: ImageField | null = null) { + const href = ImageCast(field, defaultVal)?.url.href; + return href ? `${href.split('.')[0]}${suffix}.${href.split('.')[1]}` : null; +} export function FieldValue<T extends FieldType, U extends WithoutList<T>>(field: FieldResult<T>, defaultValue: U): WithoutList<T>; // eslint-disable-next-line no-redeclare |