This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type DeepPartial<T> = { | |
[P in keyof T]?: DeepPartial<T[P]>; | |
}; | |
function isObject(item: any): boolean { | |
return item && typeof item === 'object' && !Array.isArray(item); | |
} | |
export function merge<T>(target: T, source: DeepPartial<T>): T { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getMimeTypeFromImageUrl(imageUrl: string) { | |
try { | |
const response = await fetch(imageUrl, { method: 'HEAD' }); | |
return response.headers.get('content-type'); | |
} catch (err) { | |
return null; | |
} | |
} |