mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Build prototype with Object.assign to allow minification (#1475)
This commit is contained in:
parent
d26ccf6294
commit
383b933e26
@ -117,14 +117,12 @@ function bandbool (boolOp) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
// Public instance functions
|
Object.assign(Sharp.prototype, {
|
||||||
[
|
// Public instance functions
|
||||||
removeAlpha,
|
removeAlpha,
|
||||||
extractChannel,
|
extractChannel,
|
||||||
joinChannel,
|
joinChannel,
|
||||||
bandbool
|
bandbool
|
||||||
].forEach(function (f) {
|
|
||||||
Sharp.prototype[f.name] = f;
|
|
||||||
});
|
});
|
||||||
// Class attributes
|
// Class attributes
|
||||||
Sharp.bool = bool;
|
Sharp.bool = bool;
|
||||||
|
@ -123,7 +123,7 @@ function _setColourOption (key, val) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
[
|
Object.assign(Sharp.prototype, {
|
||||||
// Public
|
// Public
|
||||||
tint,
|
tint,
|
||||||
greyscale,
|
greyscale,
|
||||||
@ -132,8 +132,6 @@ module.exports = function (Sharp) {
|
|||||||
toColorspace,
|
toColorspace,
|
||||||
// Private
|
// Private
|
||||||
_setColourOption
|
_setColourOption
|
||||||
].forEach(function (f) {
|
|
||||||
Sharp.prototype[f.name] = f;
|
|
||||||
});
|
});
|
||||||
// Class attributes
|
// Class attributes
|
||||||
Sharp.colourspace = colourspace;
|
Sharp.colourspace = colourspace;
|
||||||
|
@ -362,7 +362,7 @@ function sequentialRead (sequentialRead) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
[
|
Object.assign(Sharp.prototype, {
|
||||||
// Private
|
// Private
|
||||||
_createInputDescriptor,
|
_createInputDescriptor,
|
||||||
_write,
|
_write,
|
||||||
@ -374,7 +374,5 @@ module.exports = function (Sharp) {
|
|||||||
stats,
|
stats,
|
||||||
limitInputPixels,
|
limitInputPixels,
|
||||||
sequentialRead
|
sequentialRead
|
||||||
].forEach(function (f) {
|
|
||||||
Sharp.prototype[f.name] = f;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -383,7 +383,7 @@ function linear (a, b) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
[
|
Object.assign(Sharp.prototype, {
|
||||||
rotate,
|
rotate,
|
||||||
flip,
|
flip,
|
||||||
flop,
|
flop,
|
||||||
@ -399,7 +399,5 @@ module.exports = function (Sharp) {
|
|||||||
threshold,
|
threshold,
|
||||||
boolean,
|
boolean,
|
||||||
linear
|
linear
|
||||||
].forEach(function (f) {
|
|
||||||
Sharp.prototype[f.name] = f;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -641,7 +641,7 @@ function _pipeline (callback) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
[
|
Object.assign(Sharp.prototype, {
|
||||||
// Public
|
// Public
|
||||||
toFile,
|
toFile,
|
||||||
toBuffer,
|
toBuffer,
|
||||||
@ -658,7 +658,5 @@ module.exports = function (Sharp) {
|
|||||||
_setBooleanOption,
|
_setBooleanOption,
|
||||||
_read,
|
_read,
|
||||||
_pipeline
|
_pipeline
|
||||||
].forEach(function (f) {
|
|
||||||
Sharp.prototype[f.name] = f;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -469,13 +469,11 @@ function withoutEnlargement (withoutEnlargement) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
[
|
Object.assign(Sharp.prototype, {
|
||||||
resize,
|
resize,
|
||||||
extend,
|
extend,
|
||||||
extract,
|
extract,
|
||||||
trim
|
trim
|
||||||
].forEach(function (f) {
|
|
||||||
Sharp.prototype[f.name] = f;
|
|
||||||
});
|
});
|
||||||
// Class attributes
|
// Class attributes
|
||||||
Sharp.gravity = gravity;
|
Sharp.gravity = gravity;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user