mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +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
|
||||
*/
|
||||
module.exports = function (Sharp) {
|
||||
Object.assign(Sharp.prototype, {
|
||||
// Public instance functions
|
||||
[
|
||||
removeAlpha,
|
||||
extractChannel,
|
||||
joinChannel,
|
||||
bandbool
|
||||
].forEach(function (f) {
|
||||
Sharp.prototype[f.name] = f;
|
||||
});
|
||||
// Class attributes
|
||||
Sharp.bool = bool;
|
||||
|
@ -123,7 +123,7 @@ function _setColourOption (key, val) {
|
||||
* @private
|
||||
*/
|
||||
module.exports = function (Sharp) {
|
||||
[
|
||||
Object.assign(Sharp.prototype, {
|
||||
// Public
|
||||
tint,
|
||||
greyscale,
|
||||
@ -132,8 +132,6 @@ module.exports = function (Sharp) {
|
||||
toColorspace,
|
||||
// Private
|
||||
_setColourOption
|
||||
].forEach(function (f) {
|
||||
Sharp.prototype[f.name] = f;
|
||||
});
|
||||
// Class attributes
|
||||
Sharp.colourspace = colourspace;
|
||||
|
@ -362,7 +362,7 @@ function sequentialRead (sequentialRead) {
|
||||
* @private
|
||||
*/
|
||||
module.exports = function (Sharp) {
|
||||
[
|
||||
Object.assign(Sharp.prototype, {
|
||||
// Private
|
||||
_createInputDescriptor,
|
||||
_write,
|
||||
@ -374,7 +374,5 @@ module.exports = function (Sharp) {
|
||||
stats,
|
||||
limitInputPixels,
|
||||
sequentialRead
|
||||
].forEach(function (f) {
|
||||
Sharp.prototype[f.name] = f;
|
||||
});
|
||||
};
|
||||
|
@ -383,7 +383,7 @@ function linear (a, b) {
|
||||
* @private
|
||||
*/
|
||||
module.exports = function (Sharp) {
|
||||
[
|
||||
Object.assign(Sharp.prototype, {
|
||||
rotate,
|
||||
flip,
|
||||
flop,
|
||||
@ -399,7 +399,5 @@ module.exports = function (Sharp) {
|
||||
threshold,
|
||||
boolean,
|
||||
linear
|
||||
].forEach(function (f) {
|
||||
Sharp.prototype[f.name] = f;
|
||||
});
|
||||
};
|
||||
|
@ -641,7 +641,7 @@ function _pipeline (callback) {
|
||||
* @private
|
||||
*/
|
||||
module.exports = function (Sharp) {
|
||||
[
|
||||
Object.assign(Sharp.prototype, {
|
||||
// Public
|
||||
toFile,
|
||||
toBuffer,
|
||||
@ -658,7 +658,5 @@ module.exports = function (Sharp) {
|
||||
_setBooleanOption,
|
||||
_read,
|
||||
_pipeline
|
||||
].forEach(function (f) {
|
||||
Sharp.prototype[f.name] = f;
|
||||
});
|
||||
};
|
||||
|
@ -469,13 +469,11 @@ function withoutEnlargement (withoutEnlargement) {
|
||||
* @private
|
||||
*/
|
||||
module.exports = function (Sharp) {
|
||||
[
|
||||
Object.assign(Sharp.prototype, {
|
||||
resize,
|
||||
extend,
|
||||
extract,
|
||||
trim
|
||||
].forEach(function (f) {
|
||||
Sharp.prototype[f.name] = f;
|
||||
});
|
||||
// Class attributes
|
||||
Sharp.gravity = gravity;
|
||||
|
Loading…
x
Reference in New Issue
Block a user