mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Remove use of deprecated functions from test code
This commit is contained in:
@@ -91,6 +91,7 @@ const withMetadata = function withMetadata (withMetadata) {
|
||||
* @param {Boolean} [trellisQuantisation=false] - apply trellis quantisation, requires mozjpeg
|
||||
* @param {Boolean} [overshootDeringing=false] - apply overshoot deringing, requires mozjpeg
|
||||
* @param {Boolean} [optimiseScans=false] - optimise progressive scans, forces progressive, requires mozjpeg
|
||||
* @param {Boolean} [optimizeScans=false] - alternative spelling of optimiseScans
|
||||
* @param {Boolean} [options.force=true] - force JPEG output, otherwise attempt to use input format
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid options
|
||||
@@ -121,7 +122,7 @@ const jpeg = function jpeg (options) {
|
||||
if (is.defined(options.overshootDeringing)) {
|
||||
this._setBooleanOption('jpegOvershootDeringing', options.overshootDeringing);
|
||||
}
|
||||
options.optimiseScans = options.optimiseScans || options.optimizeScans;
|
||||
options.optimiseScans = is.bool(options.optimiseScans) ? options.optimiseScans : options.optimizeScans;
|
||||
if (is.defined(options.optimiseScans)) {
|
||||
this._setBooleanOption('jpegOptimiseScans', options.optimiseScans);
|
||||
if (options.optimiseScans) {
|
||||
@@ -170,13 +171,11 @@ const png = function png (options) {
|
||||
* @throws {Error} Invalid options
|
||||
*/
|
||||
const webp = function webp (options) {
|
||||
if (is.object(options)) {
|
||||
if (is.defined(options.quality)) {
|
||||
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
|
||||
this.options.webpQuality = options.quality;
|
||||
} else {
|
||||
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
|
||||
}
|
||||
if (is.object(options) && is.defined(options.quality)) {
|
||||
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
|
||||
this.options.webpQuality = options.quality;
|
||||
} else {
|
||||
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
|
||||
}
|
||||
}
|
||||
return this._updateFormatOut('webp', options);
|
||||
@@ -191,13 +190,11 @@ const webp = function webp (options) {
|
||||
* @throws {Error} Invalid options
|
||||
*/
|
||||
const tiff = function tiff (options) {
|
||||
if (is.object(options)) {
|
||||
if (is.defined(options.quality)) {
|
||||
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
|
||||
this.options.tiffQuality = options.quality;
|
||||
} else {
|
||||
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
|
||||
}
|
||||
if (is.object(options) && is.defined(options.quality)) {
|
||||
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
|
||||
this.options.tiffQuality = options.quality;
|
||||
} else {
|
||||
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
|
||||
}
|
||||
}
|
||||
return this._updateFormatOut('tiff', options);
|
||||
@@ -412,6 +409,7 @@ const _pipeline = function _pipeline (callback) {
|
||||
};
|
||||
|
||||
// Deprecated output options
|
||||
/* istanbul ignore next */
|
||||
const quality = util.deprecate(function (quality) {
|
||||
const formatOut = this.options.formatOut;
|
||||
const options = { quality: quality };
|
||||
@@ -419,6 +417,7 @@ const quality = util.deprecate(function (quality) {
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'quality: use jpeg({ quality: ... }), webp({ quality: ... }) and/or tiff({ quality: ... }) instead');
|
||||
/* istanbul ignore next */
|
||||
const progressive = util.deprecate(function (progressive) {
|
||||
const formatOut = this.options.formatOut;
|
||||
const options = { progressive: (progressive !== false) };
|
||||
@@ -426,36 +425,42 @@ const progressive = util.deprecate(function (progressive) {
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'progressive: use jpeg({ progressive: ... }) and/or png({ progressive: ... }) instead');
|
||||
/* istanbul ignore next */
|
||||
const compressionLevel = util.deprecate(function (compressionLevel) {
|
||||
const formatOut = this.options.formatOut;
|
||||
this.png({ compressionLevel: compressionLevel });
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'compressionLevel: use png({ compressionLevel: ... }) instead');
|
||||
/* istanbul ignore next */
|
||||
const withoutAdaptiveFiltering = util.deprecate(function (withoutAdaptiveFiltering) {
|
||||
const formatOut = this.options.formatOut;
|
||||
this.png({ adaptiveFiltering: (withoutAdaptiveFiltering === false) });
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'withoutAdaptiveFiltering: use png({ adaptiveFiltering: ... }) instead');
|
||||
/* istanbul ignore next */
|
||||
const withoutChromaSubsampling = util.deprecate(function (withoutChromaSubsampling) {
|
||||
const formatOut = this.options.formatOut;
|
||||
this.jpeg({ chromaSubsampling: (withoutChromaSubsampling === false) ? '4:2:0' : '4:4:4' });
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'withoutChromaSubsampling: use jpeg({ chromaSubsampling: "4:4:4" }) instead');
|
||||
/* istanbul ignore next */
|
||||
const trellisQuantisation = util.deprecate(function (trellisQuantisation) {
|
||||
const formatOut = this.options.formatOut;
|
||||
this.jpeg({ trellisQuantisation: (trellisQuantisation !== false) });
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'trellisQuantisation: use jpeg({ trellisQuantisation: ... }) instead');
|
||||
/* istanbul ignore next */
|
||||
const overshootDeringing = util.deprecate(function (overshootDeringing) {
|
||||
const formatOut = this.options.formatOut;
|
||||
this.jpeg({ overshootDeringing: (overshootDeringing !== false) });
|
||||
this.options.formatOut = formatOut;
|
||||
return this;
|
||||
}, 'overshootDeringing: use jpeg({ overshootDeringing: ... }) instead');
|
||||
/* istanbul ignore next */
|
||||
const optimiseScans = util.deprecate(function (optimiseScans) {
|
||||
const formatOut = this.options.formatOut;
|
||||
this.jpeg({ optimiseScans: (optimiseScans !== false) });
|
||||
|
||||
Reference in New Issue
Block a user