Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

impro

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

impro - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

2

package.json
{
"name": "impro",
"version": "0.3.1",
"version": "0.3.2",
"description": "Image processing engine",

@@ -5,0 +5,0 @@ "author": "Andreas Lind <andreaslindpetersen@gmail.com>",

@@ -15,2 +15,12 @@ const requireOr = require('require-or');

function patchPreviousCommandArgument(operation, argUpdates, indexInArg) {
operation = { ...operation };
operation.args = [...operation.args];
operation.args[indexInArg] = {
...operation.args[indexInArg],
...argUpdates
};
return operation;
}
const maxDimension = 16384;

@@ -185,19 +195,59 @@

if (operation.name === 'crop') {
name = 'resize';
args = [null, null, { fit: 'cover', position: args[0] }];
const locatedIndex = locatePreviousCommand(
operationsForExecution,
name
'resize'
);
if (locatedIndex > -1) {
let locatedOperation = operationsForExecution[locatedIndex];
locatedOperation = {
...locatedOperation,
args: locatedOperation.args.concat(args[2])
};
const locatedOperation = patchPreviousCommandArgument(
operationsForExecution[locatedIndex],
{ fit: 'cover', position: args[0] },
2
);
operationsForExecution[locatedIndex] = locatedOperation;
return;
} else {
name = 'resize';
args = [null, null, { fit: 'cover', position: args[0] }];
}
}
// in sharp withoutEnlargement is implemented as options to resize
if (operation.name === 'withoutEnlargement') {
const locatedIndex = locatePreviousCommand(
operationsForExecution,
'resize'
);
if (locatedIndex > -1) {
const locatedOperation = patchPreviousCommandArgument(
operationsForExecution[locatedIndex],
{ fit: 'inside' },
2
);
operationsForExecution[locatedIndex] = locatedOperation;
return;
} else {
throw new Error(
'sharp: withoutEnlargement() operation must follow resize'
);
}
}
// in sharp ignoreAspectRatio is implemented as options to resize
if (operation.name === 'ignoreAspectRatio') {
const locatedIndex = locatePreviousCommand(
operationsForExecution,
'resize'
);
if (locatedIndex > -1) {
const locatedOperation = patchPreviousCommandArgument(
operationsForExecution[locatedIndex],
{ fit: 'fill' },
2
);
operationsForExecution[locatedIndex] = locatedOperation;
return;
} else {
throw new Error(
'sharp: ignoreAspectRatio() operation must follow resize'
);
}
}
// in sharp quality is implemented as an option to the target type

@@ -210,9 +260,7 @@ if (operation.name === 'quality') {

if (locatedIndex > -1) {
let locatedOperation = operationsForExecution[locatedIndex];
locatedOperation = {
...locatedOperation,
args: [
{ ...locatedOperation.args[0], quality: args[0] }
]
};
const locatedOperation = patchPreviousCommandArgument(
operationsForExecution[locatedIndex],
{ quality: args[0] },
0
);
operationsForExecution[locatedIndex] = locatedOperation;

@@ -219,0 +267,0 @@ return;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc