mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Update dev deps, deconstify all the functions, API doc refresh
This commit is contained in:
@@ -27,7 +27,7 @@ const colourspace = {
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameter
|
||||
*/
|
||||
const background = function background (rgba) {
|
||||
function background (rgba) {
|
||||
const colour = color(rgba);
|
||||
this.options.background = [
|
||||
colour.red(),
|
||||
@@ -36,7 +36,7 @@ const background = function background (rgba) {
|
||||
Math.round(colour.alpha() * 255)
|
||||
];
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to 8-bit greyscale; 256 shades of grey.
|
||||
@@ -48,19 +48,19 @@ const background = function background (rgba) {
|
||||
* @param {Boolean} [greyscale=true]
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const greyscale = function greyscale (greyscale) {
|
||||
function greyscale (greyscale) {
|
||||
this.options.greyscale = is.bool(greyscale) ? greyscale : true;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternative spelling of `greyscale`.
|
||||
* @param {Boolean} [grayscale=true]
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
const grayscale = function grayscale (grayscale) {
|
||||
function grayscale (grayscale) {
|
||||
return this.greyscale(grayscale);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output colourspace.
|
||||
@@ -69,13 +69,13 @@ const grayscale = function grayscale (grayscale) {
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameters
|
||||
*/
|
||||
const toColourspace = function toColourspace (colourspace) {
|
||||
function toColourspace (colourspace) {
|
||||
if (!is.string(colourspace)) {
|
||||
throw new Error('Invalid output colourspace ' + colourspace);
|
||||
}
|
||||
this.options.colourspace = colourspace;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternative spelling of `toColourspace`.
|
||||
@@ -83,9 +83,9 @@ const toColourspace = function toColourspace (colourspace) {
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameters
|
||||
*/
|
||||
const toColorspace = function toColorspace (colorspace) {
|
||||
function toColorspace (colorspace) {
|
||||
return this.toColourspace(colorspace);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate the Sharp prototype with colour-related functions.
|
||||
|
||||
Reference in New Issue
Block a user