@crombolo/core 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/documents.ts +8 -0
package/package.json
CHANGED
package/src/documents.ts
CHANGED
|
@@ -127,3 +127,11 @@ export function normaliseValueCulture(
|
|
|
127
127
|
): string | null {
|
|
128
128
|
return propertyVariesByCulture ? culture : null
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
/** The file path a media item's `umbracoFile` holds, whether an upload or a cropper value. */
|
|
132
|
+
export function mediaFileOf(media: Pick<DocumentAggregate, 'values'>): string | null {
|
|
133
|
+
const value = media.values.find((v) => v.alias === 'umbracoFile')?.value
|
|
134
|
+
if (typeof value === 'string') return value || null
|
|
135
|
+
const src = (value as { src?: unknown } | null | undefined)?.src
|
|
136
|
+
return typeof src === 'string' && src ? src : null
|
|
137
|
+
}
|