mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Update semistandard dependency plus linting improvements
This commit is contained in:
parent
a71e562ff7
commit
3e76ee25e3
@ -78,7 +78,7 @@
|
|||||||
"node-cpplint": "^0.4.0",
|
"node-cpplint": "^0.4.0",
|
||||||
"nyc": "^10.0.0",
|
"nyc": "^10.0.0",
|
||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"semistandard": "^9.1.0",
|
"semistandard": "^9.2.1",
|
||||||
"unzip": "^0.1.11"
|
"unzip": "^0.1.11"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
@ -13,9 +13,11 @@ describe('Convolve', function () {
|
|||||||
height: 3,
|
height: 3,
|
||||||
scale: 50,
|
scale: 50,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
kernel: [ 10, 20, 10,
|
kernel: [
|
||||||
0, 0, 0,
|
10, 20, 10,
|
||||||
10, 20, 10 ]
|
0, 0, 0,
|
||||||
|
10, 20, 10
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -31,9 +33,11 @@ describe('Convolve', function () {
|
|||||||
.convolve({
|
.convolve({
|
||||||
width: 3,
|
width: 3,
|
||||||
height: 3,
|
height: 3,
|
||||||
kernel: [ 1, 0, 1,
|
kernel: [
|
||||||
2, 0, 2,
|
1, 0, 1,
|
||||||
1, 0, 1 ]
|
2, 0, 2,
|
||||||
|
1, 0, 1
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -50,9 +54,11 @@ describe('Convolve', function () {
|
|||||||
.convolve({
|
.convolve({
|
||||||
width: 3,
|
width: 3,
|
||||||
height: 3,
|
height: 3,
|
||||||
kernel: [ -1, 0, 1,
|
kernel: [
|
||||||
-2, 0, 2,
|
-1, 0, 1,
|
||||||
-1, 0, 1 ]
|
-2, 0, 2,
|
||||||
|
-1, 0, 1
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
@ -38,9 +38,11 @@ describe('Image channel insertion', function () {
|
|||||||
it('Grayscale to RGBA, buffer', function (done) {
|
it('Grayscale to RGBA, buffer', function (done) {
|
||||||
sharp(fixtures.inputPng) // gray -> red
|
sharp(fixtures.inputPng) // gray -> red
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.joinChannel([fixtures.inputPngTestJoinChannel,
|
.joinChannel([
|
||||||
fixtures.inputPngStripesH,
|
fixtures.inputPngTestJoinChannel,
|
||||||
fixtures.inputPngStripesV]) // new green + blue + alpha channel
|
fixtures.inputPngStripesH,
|
||||||
|
fixtures.inputPngStripesV
|
||||||
|
]) // new green + blue + alpha channel
|
||||||
.toColourspace(sharp.colourspace.srgb)
|
.toColourspace(sharp.colourspace.srgb)
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -54,9 +56,11 @@ describe('Image channel insertion', function () {
|
|||||||
it('Grayscale to RGBA, file', function (done) {
|
it('Grayscale to RGBA, file', function (done) {
|
||||||
sharp(fixtures.inputPng) // gray -> red
|
sharp(fixtures.inputPng) // gray -> red
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel), // new green channel
|
.joinChannel([
|
||||||
fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
fs.readFileSync(fixtures.inputPngTestJoinChannel), // new green channel
|
||||||
fs.readFileSync(fixtures.inputPngStripesV)]) // new alpha channel
|
fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
||||||
|
fs.readFileSync(fixtures.inputPngStripesV) // new alpha channel
|
||||||
|
])
|
||||||
.toColourspace('srgb')
|
.toColourspace('srgb')
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -70,9 +74,11 @@ describe('Image channel insertion', function () {
|
|||||||
it('Grayscale to CMYK, buffers', function (done) {
|
it('Grayscale to CMYK, buffers', function (done) {
|
||||||
sharp(fixtures.inputPng) // gray -> magenta
|
sharp(fixtures.inputPng) // gray -> magenta
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel), // new cyan channel
|
.joinChannel([
|
||||||
fs.readFileSync(fixtures.inputPngStripesH), // new yellow channel
|
fs.readFileSync(fixtures.inputPngTestJoinChannel), // new cyan channel
|
||||||
fs.readFileSync(fixtures.inputPngStripesV)]) // new black channel
|
fs.readFileSync(fixtures.inputPngStripesH), // new yellow channel
|
||||||
|
fs.readFileSync(fixtures.inputPngStripesV) // new black channel
|
||||||
|
])
|
||||||
.toColorspace('cmyk')
|
.toColorspace('cmyk')
|
||||||
.toFormat('jpeg')
|
.toFormat('jpeg')
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
@ -92,12 +98,13 @@ describe('Image channel insertion', function () {
|
|||||||
.then(function (buffers) {
|
.then(function (buffers) {
|
||||||
sharp(fixtures.inputPng)
|
sharp(fixtures.inputPng)
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.joinChannel(buffers,
|
.joinChannel(buffers, {
|
||||||
{ raw: {
|
raw: {
|
||||||
width: 320,
|
width: 320,
|
||||||
height: 240,
|
height: 240,
|
||||||
channels: 1
|
channels: 1
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
@ -115,8 +122,10 @@ describe('Image channel insertion', function () {
|
|||||||
sharp(fixtures.inputPng) // gray -> red
|
sharp(fixtures.inputPng) // gray -> red
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel)]) // new green channel
|
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel)]) // new green channel
|
||||||
.joinChannel([fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
.joinChannel([
|
||||||
fs.readFileSync(fixtures.inputPngStripesV)]) // new alpha channel
|
fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
||||||
|
fs.readFileSync(fixtures.inputPngStripesV) // new alpha channel
|
||||||
|
])
|
||||||
.toColourspace('srgb')
|
.toColourspace('srgb')
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -135,15 +144,13 @@ describe('Image channel insertion', function () {
|
|||||||
|
|
||||||
it('Invalid input', function () {
|
it('Invalid input', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp(fixtures.inputJpg)
|
sharp(fixtures.inputJpg).joinChannel(1);
|
||||||
.joinChannel(1);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('No arguments', function () {
|
it('No arguments', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp(fixtures.inputJpg)
|
sharp(fixtures.inputJpg).joinChannel();
|
||||||
.joinChannel();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user