Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
20 lines
731 B
Plaintext
20 lines
731 B
Plaintext
/**
|
|
* Sanitize the resize config. If the resize config has the `withoutReduction`
|
|
* property set to true, the `fit` and `position` properties will be set to `contain`
|
|
* and `top left` respectively.
|
|
*
|
|
* @param resizeConfig - the resize config
|
|
* @returns a sanitized resize config
|
|
*/ export const sanitizeResizeConfig = (resizeConfig)=>{
|
|
if (resizeConfig.withoutReduction) {
|
|
return {
|
|
...resizeConfig,
|
|
// Why fit `contain` should also be set to https://github.com/lovell/sharp/issues/3595
|
|
fit: resizeConfig?.fit || 'contain',
|
|
position: resizeConfig?.position || 'left top'
|
|
};
|
|
}
|
|
return resizeConfig;
|
|
};
|
|
|
|
//# sourceMappingURL=sanitizeResizeConfig.js.map |