diff options
author | bobzel <zzzman@gmail.com> | 2025-03-06 16:17:47 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-03-06 16:17:47 -0500 |
commit | 5ad858090f3006631062877d90120e3cc505fada (patch) | |
tree | 9f87a8e1e7098a1025f6f4aac332dbc854db5be3 /src/fields/Types.ts | |
parent | 9c2a7c14fd9d0e44609aab30c6323583162009db (diff) | |
parent | adaa107aac8558fa6f46e6ba1263c650c212d506 (diff) |
Merge branch 'master' into aarav_edit
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 |