mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Update dev deps, deconstify all the functions, API doc refresh
This commit is contained in:
@@ -101,7 +101,7 @@ const interpolator = {
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameters
|
||||
*/
|
||||
const resize = function resize (width, height, options) {
|
||||
function resize (width, height, options) {
|
||||
if (is.defined(width)) {
|
||||
if (is.integer(width) && is.inRange(width, 1, this.constructor.maximum.width)) {
|
||||
this.options.width = width;
|
||||
@@ -144,7 +144,7 @@ const resize = function resize (width, height, options) {
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Crop the resized image to the exact size specified, the default behaviour.
|
||||
@@ -172,7 +172,7 @@ const resize = function resize (width, height, options) {
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameters
|
||||
*/
|
||||
const crop = function crop (crop) {
|
||||
function crop (crop) {
|
||||
this.options.canvas = 'crop';
|
||||
if (!is.defined(crop)) {
|
||||
// Default
|
||||
@@ -193,7 +193,7 @@ const crop = function crop (crop) {
|
||||
throw is.invalidParameterError('crop', 'valid crop id/name/strategy', crop);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Preserving aspect ratio, resize the image to the maximum `width` or `height` specified
|
||||
@@ -218,10 +218,10 @@ const crop = function crop (crop) {
|
||||
*
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const embed = function embed () {
|
||||
function embed () {
|
||||
this.options.canvas = 'embed';
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Preserving aspect ratio, resize the image to be as large as possible
|
||||
@@ -242,10 +242,10 @@ const embed = function embed () {
|
||||
*
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const max = function max () {
|
||||
function max () {
|
||||
this.options.canvas = 'max';
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Preserving aspect ratio, resize the image to be as small as possible
|
||||
@@ -255,20 +255,20 @@ const max = function max () {
|
||||
*
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const min = function min () {
|
||||
function min () {
|
||||
this.options.canvas = 'min';
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignoring the aspect ratio of the input, stretch the image to
|
||||
* the exact `width` and/or `height` provided via `resize`.
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const ignoreAspectRatio = function ignoreAspectRatio () {
|
||||
function ignoreAspectRatio () {
|
||||
this.options.canvas = 'ignore_aspect';
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not enlarge the output image if the input image width *or* height are already less than the required dimensions.
|
||||
@@ -277,10 +277,10 @@ const ignoreAspectRatio = function ignoreAspectRatio () {
|
||||
* @param {Boolean} [withoutEnlargement=true]
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const withoutEnlargement = function withoutEnlargement (withoutEnlargement) {
|
||||
function withoutEnlargement (withoutEnlargement) {
|
||||
this.options.withoutEnlargement = is.bool(withoutEnlargement) ? withoutEnlargement : true;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate the Sharp prototype with resize-related functions.
|
||||
|
||||
Reference in New Issue
Block a user