aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields/Types.ts')
-rw-r--r--src/fields/Types.ts4
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