mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Add support for passing the crop strategy as a string (#735)
This commit is contained in:
committed by
Lovell Fuller
parent
6b1d698448
commit
9707f8c5d2
@@ -186,6 +186,9 @@ const crop = function crop (crop) {
|
||||
} else if (is.integer(crop) && crop >= strategy.entropy) {
|
||||
// Strategy
|
||||
this.options.crop = crop;
|
||||
} else if (is.string(crop) && is.integer(strategy[crop])) {
|
||||
// Strategy (string)
|
||||
this.options.crop = strategy[crop];
|
||||
} else {
|
||||
throw is.invalidParameterError('crop', 'valid crop id/name/strategy', crop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user