Add support for passing the crop strategy as a string (#735)

This commit is contained in:
Andreas Lind
2017-03-16 15:27:09 +01:00
committed by Lovell Fuller
parent 6b1d698448
commit 9707f8c5d2
2 changed files with 35 additions and 0 deletions

View File

@@ -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);
}