mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Update semistandard linter to latest
This commit is contained in:
parent
1c4f6f75f3
commit
03394556b5
@ -113,7 +113,7 @@
|
||||
"prebuild": "^8.1.2",
|
||||
"prebuild-ci": "^2.2.3",
|
||||
"rimraf": "^2.6.2",
|
||||
"semistandard": "^12.0.1"
|
||||
"semistandard": "^13.0.1"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"config": {
|
||||
|
@ -22,7 +22,7 @@ const median = function (values) {
|
||||
// List of files
|
||||
fs.readdirSync(userDataDir).forEach(function (file) {
|
||||
// Contents of file
|
||||
const lines = fs.readFileSync(path.join(userDataDir, file), {encoding: 'utf-8'}).split(/\r\n/);
|
||||
const lines = fs.readFileSync(path.join(userDataDir, file), { encoding: 'utf-8' }).split(/\r\n/);
|
||||
// First line = number of entries
|
||||
const entries = parseInt(lines[0], 10);
|
||||
// Verify number of entries
|
||||
|
@ -8,7 +8,7 @@ describe('Deprecated background', function () {
|
||||
it('Flatten to RGB orange', function (done) {
|
||||
sharp(fixtures.inputPngWithTransparency)
|
||||
.flatten()
|
||||
.background({r: 255, g: 102, b: 0})
|
||||
.background({ r: 255, g: 102, b: 0 })
|
||||
.resize(400, 300)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -35,7 +35,7 @@ describe('Deprecated background', function () {
|
||||
const output = fixtures.path('output.flatten-rgb16-orange.jpg');
|
||||
sharp(fixtures.inputPngWithTransparency16bit)
|
||||
.flatten()
|
||||
.background({r: 255, g: 102, b: 0})
|
||||
.background({ r: 255, g: 102, b: 0 })
|
||||
.toFile(output, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, info.size > 0);
|
||||
@ -61,7 +61,7 @@ describe('Deprecated background', function () {
|
||||
it('extend all sides equally with RGB', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(120)
|
||||
.background({r: 255, g: 0, b: 0})
|
||||
.background({ r: 255, g: 0, b: 0 })
|
||||
.extend(10)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
|
@ -38,7 +38,7 @@ describe('Deprecated embed', function () {
|
||||
it('JPEG within WebP, to include alpha channel', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed()
|
||||
.webp()
|
||||
.toBuffer(function (err, data, info) {
|
||||
@ -86,7 +86,7 @@ describe('Deprecated embed', function () {
|
||||
sharp(fixtures.inputPngWithTransparency16bit)
|
||||
.resize(32, 16)
|
||||
.embed()
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
@ -102,7 +102,7 @@ describe('Deprecated embed', function () {
|
||||
sharp(fixtures.inputPngWithGreyAlpha)
|
||||
.resize(32, 16)
|
||||
.embed()
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
@ -153,7 +153,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal northwest', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.northwest)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -169,7 +169,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal north', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.north)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -185,7 +185,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal northeast', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.northeast)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -201,7 +201,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal east', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.east)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -217,7 +217,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal southeast', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.southeast)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -233,7 +233,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal south', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.south)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -249,7 +249,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal southwest', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.southwest)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -265,7 +265,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal west', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.west)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -281,7 +281,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity horizontal center', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 100)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.center)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -297,7 +297,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical northwest', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.northwest)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -313,7 +313,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical north', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.north)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -329,7 +329,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical northeast', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.northeast)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -345,7 +345,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical east', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.east)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -361,7 +361,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical southeast', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.southeast)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -377,7 +377,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical south', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.south)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -393,7 +393,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical southwest', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.southwest)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -409,7 +409,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical west', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.west)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -425,7 +425,7 @@ describe('Deprecated embed', function () {
|
||||
it('Embed gravity vertical center', function (done) {
|
||||
sharp(fixtures.inputPngEmbed)
|
||||
.resize(200, 200)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.background({ r: 0, g: 0, b: 0, alpha: 0 })
|
||||
.embed(sharp.gravity.center)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
|
@ -54,7 +54,7 @@ describe('Extend', function () {
|
||||
});
|
||||
it('partial object fails', function () {
|
||||
assert.throws(function () {
|
||||
sharp().extend({top: 1});
|
||||
sharp().extend({ top: 1 });
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -49,8 +49,8 @@ describe('failOnError', function () {
|
||||
it('returns errors to callback for truncated JPEG when failOnError is set', function (done) {
|
||||
sharp(fixtures.inputJpgTruncated, { failOnError: true }).toBuffer(function (err, data, info) {
|
||||
assert.ok(err.message.includes('VipsJpeg: Premature end of JPEG file'), err);
|
||||
assert.equal(data, null);
|
||||
assert.equal(info, null);
|
||||
assert.strictEqual(data, null);
|
||||
assert.strictEqual(info, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -58,8 +58,8 @@ describe('failOnError', function () {
|
||||
it('returns errors to callback for truncated PNG when failOnError is set', function (done) {
|
||||
sharp(fixtures.inputPngTruncated, { failOnError: true }).toBuffer(function (err, data, info) {
|
||||
assert.ok(err.message.includes('vipspng: libpng read error'), err);
|
||||
assert.equal(data, null);
|
||||
assert.equal(info, null);
|
||||
assert.strictEqual(data, null);
|
||||
assert.strictEqual(info, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -79,7 +79,7 @@ describe('Input/output', function () {
|
||||
const pipeline = sharp().resize(1, 1);
|
||||
fs.createReadStream(fixtures.inputJpg).pipe(pipeline);
|
||||
return pipeline
|
||||
.toBuffer({resolveWithObject: false})
|
||||
.toBuffer({ resolveWithObject: false })
|
||||
.then(function (data) {
|
||||
assert.strictEqual(true, data instanceof Buffer);
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
@ -90,7 +90,7 @@ describe('Input/output', function () {
|
||||
const pipeline = sharp().resize(1, 1);
|
||||
fs.createReadStream(fixtures.inputJpg).pipe(pipeline);
|
||||
return pipeline
|
||||
.toBuffer({resolveWithObject: true})
|
||||
.toBuffer({ resolveWithObject: true })
|
||||
.then(function (object) {
|
||||
assert.strictEqual('object', typeof object);
|
||||
assert.strictEqual('object', typeof object.info);
|
||||
@ -106,7 +106,7 @@ describe('Input/output', function () {
|
||||
it('Read from File and write to Buffer via Promise resolved with Buffer', function () {
|
||||
return sharp(fixtures.inputJpg)
|
||||
.resize(1, 1)
|
||||
.toBuffer({resolveWithObject: false})
|
||||
.toBuffer({ resolveWithObject: false })
|
||||
.then(function (data) {
|
||||
assert.strictEqual(true, data instanceof Buffer);
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
@ -116,7 +116,7 @@ describe('Input/output', function () {
|
||||
it('Read from File and write to Buffer via Promise resolved with Object', function () {
|
||||
return sharp(fixtures.inputJpg)
|
||||
.resize(1, 1)
|
||||
.toBuffer({resolveWithObject: true})
|
||||
.toBuffer({ resolveWithObject: true })
|
||||
.then(function (object) {
|
||||
assert.strictEqual('object', typeof object);
|
||||
assert.strictEqual('object', typeof object.info);
|
||||
@ -462,7 +462,7 @@ describe('Input/output', function () {
|
||||
|
||||
it('should work for webp alpha quality', function (done) {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({alphaQuality: 80})
|
||||
.webp({ alphaQuality: 80 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
@ -473,7 +473,7 @@ describe('Input/output', function () {
|
||||
|
||||
it('should work for webp lossless', function (done) {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({lossless: true})
|
||||
.webp({ lossless: true })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
@ -484,7 +484,7 @@ describe('Input/output', function () {
|
||||
|
||||
it('should work for webp near-lossless', function (done) {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({nearLossless: true, quality: 50})
|
||||
.webp({ nearLossless: true, quality: 50 })
|
||||
.toBuffer(function (err50, data50, info50) {
|
||||
if (err50) throw err50;
|
||||
assert.strictEqual(true, data50.length > 0);
|
||||
@ -495,7 +495,7 @@ describe('Input/output', function () {
|
||||
|
||||
it('should use near-lossless when both lossless and nearLossless are specified', function (done) {
|
||||
sharp(fixtures.inputPngAlphaPremultiplicationSmall)
|
||||
.webp({nearLossless: true, quality: 50, lossless: true})
|
||||
.webp({ nearLossless: true, quality: 50, lossless: true })
|
||||
.toBuffer(function (err50, data50, info50) {
|
||||
if (err50) throw err50;
|
||||
assert.strictEqual(true, data50.length > 0);
|
||||
@ -817,7 +817,7 @@ describe('Input/output', function () {
|
||||
assert.strictEqual(320, withInfo.width);
|
||||
assert.strictEqual(240, withInfo.height);
|
||||
// Verify image is of a different size (progressive output even without mozjpeg)
|
||||
assert.notEqual(withData.length, withoutData.length);
|
||||
assert.notStrictEqual(withData.length, withoutData.length);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -887,7 +887,7 @@ describe('Input/output', function () {
|
||||
it('Convert SVG to PNG at default 72DPI', function (done) {
|
||||
sharp(fixtures.inputSvg)
|
||||
.resize(1024)
|
||||
.extract({left: 290, top: 760, width: 40, height: 40})
|
||||
.extract({ left: 290, top: 760, width: 40, height: 40 })
|
||||
.toFormat('png')
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -908,7 +908,7 @@ describe('Input/output', function () {
|
||||
it('Convert SVG to PNG at 1200DPI', function (done) {
|
||||
sharp(fixtures.inputSvg, { density: 1200 })
|
||||
.resize(1024)
|
||||
.extract({left: 290, top: 760, width: 40, height: 40})
|
||||
.extract({ left: 290, top: 760, width: 40, height: 40 })
|
||||
.toFormat('png')
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -1364,7 +1364,7 @@ describe('Input/output', function () {
|
||||
|
||||
it('Save Vips V file', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.extract({left: 910, top: 1105, width: 70, height: 60})
|
||||
.extract({ left: 910, top: 1105, width: 70, height: 60 })
|
||||
.toFile(fixtures.outputV, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, info.size > 0);
|
||||
@ -1554,7 +1554,7 @@ describe('Input/output', function () {
|
||||
width: info.width,
|
||||
height: info.height,
|
||||
channels: info.channels
|
||||
}})
|
||||
} })
|
||||
.jpeg()
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -1581,7 +1581,7 @@ describe('Input/output', function () {
|
||||
width: info.width,
|
||||
height: info.height,
|
||||
channels: info.channels
|
||||
}})
|
||||
} })
|
||||
.png()
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -1683,7 +1683,7 @@ describe('Input/output', function () {
|
||||
assert.strictEqual(472, info.height);
|
||||
assert.strictEqual(3, info.channels);
|
||||
});
|
||||
const badPipeline = sharp(null, {raw: {width: 840, height: 500, channels: 3}})
|
||||
const badPipeline = sharp(null, { raw: { width: 840, height: 500, channels: 3 } })
|
||||
.toFormat('jpeg')
|
||||
.toBuffer(function (err, data, info) {
|
||||
assert.strictEqual(err.message.indexOf('memory area too small') > 0, true);
|
||||
@ -1691,7 +1691,7 @@ describe('Input/output', function () {
|
||||
const inPipeline = sharp()
|
||||
.resize(840, 472)
|
||||
.raw();
|
||||
const goodPipeline = sharp(null, {raw: {width: 840, height: 472, channels: 3}})
|
||||
const goodPipeline = sharp(null, { raw: { width: 840, height: 472, channels: 3 } })
|
||||
.toFormat('jpeg')
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
|
@ -138,7 +138,7 @@ describe('Image channel insertion', function () {
|
||||
|
||||
it('Invalid raw buffer description', function () {
|
||||
assert.throws(function () {
|
||||
sharp().joinChannel(fs.readFileSync(fixtures.inputPng), {raw: {}});
|
||||
sharp().joinChannel(fs.readFileSync(fixtures.inputPng), { raw: {} });
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -449,12 +449,12 @@ describe('Image metadata', function () {
|
||||
describe('Invalid withMetadata parameters', function () {
|
||||
it('String orientation', function () {
|
||||
assert.throws(function () {
|
||||
sharp().withMetadata({orientation: 'zoinks'});
|
||||
sharp().withMetadata({ orientation: 'zoinks' });
|
||||
});
|
||||
});
|
||||
it('Negative orientation', function () {
|
||||
assert.throws(function () {
|
||||
sharp().withMetadata({orientation: -1});
|
||||
sharp().withMetadata({ orientation: -1 });
|
||||
});
|
||||
});
|
||||
it('Zero orientation', function () {
|
||||
@ -464,7 +464,7 @@ describe('Image metadata', function () {
|
||||
});
|
||||
it('Too large orientation', function () {
|
||||
assert.throws(function () {
|
||||
sharp().withMetadata({orientation: 9});
|
||||
sharp().withMetadata({ orientation: 9 });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ describe('Rotation', function () {
|
||||
|
||||
it('Rotate by 30 degrees with semi-transparent background', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.rotate(30, {background: { r: 255, g: 0, b: 0, alpha: 0.5 }})
|
||||
.rotate(30, { background: { r: 255, g: 0, b: 0, alpha: 0.5 } })
|
||||
.resize(320)
|
||||
.png()
|
||||
.toBuffer(function (err, data, info) {
|
||||
@ -39,7 +39,7 @@ describe('Rotation', function () {
|
||||
|
||||
it('Rotate by 30 degrees with solid background', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.rotate(30, {background: { r: 255, g: 0, b: 0, alpha: 0.5 }})
|
||||
.rotate(30, { background: { r: 255, g: 0, b: 0, alpha: 0.5 } })
|
||||
.resize(320)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -208,7 +208,7 @@ describe('Rotation', function () {
|
||||
sharp(fixtures.inputJpgWithExif)
|
||||
.rotate()
|
||||
.resize(320)
|
||||
.withMetadata({orientation: 3})
|
||||
.withMetadata({ orientation: 3 })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
|
@ -132,7 +132,7 @@ describe('Threshold', function () {
|
||||
it('color threshold', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(128, {'grayscale': false})
|
||||
.threshold(128, { grayscale: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
|
Loading…
x
Reference in New Issue
Block a user