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",
|
||||
"nyc": "^10.0.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"semistandard": "^9.1.0",
|
||||
"semistandard": "^9.2.1",
|
||||
"unzip": "^0.1.11"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
|
@ -13,9 +13,11 @@ describe('Convolve', function () {
|
||||
height: 3,
|
||||
scale: 50,
|
||||
offset: 0,
|
||||
kernel: [ 10, 20, 10,
|
||||
kernel: [
|
||||
10, 20, 10,
|
||||
0, 0, 0,
|
||||
10, 20, 10 ]
|
||||
10, 20, 10
|
||||
]
|
||||
})
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -31,9 +33,11 @@ describe('Convolve', function () {
|
||||
.convolve({
|
||||
width: 3,
|
||||
height: 3,
|
||||
kernel: [ 1, 0, 1,
|
||||
kernel: [
|
||||
1, 0, 1,
|
||||
2, 0, 2,
|
||||
1, 0, 1 ]
|
||||
1, 0, 1
|
||||
]
|
||||
})
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -50,9 +54,11 @@ describe('Convolve', function () {
|
||||
.convolve({
|
||||
width: 3,
|
||||
height: 3,
|
||||
kernel: [ -1, 0, 1,
|
||||
kernel: [
|
||||
-1, 0, 1,
|
||||
-2, 0, 2,
|
||||
-1, 0, 1 ]
|
||||
-1, 0, 1
|
||||
]
|
||||
})
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
|
@ -38,9 +38,11 @@ describe('Image channel insertion', function () {
|
||||
it('Grayscale to RGBA, buffer', function (done) {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel([fixtures.inputPngTestJoinChannel,
|
||||
.joinChannel([
|
||||
fixtures.inputPngTestJoinChannel,
|
||||
fixtures.inputPngStripesH,
|
||||
fixtures.inputPngStripesV]) // new green + blue + alpha channel
|
||||
fixtures.inputPngStripesV
|
||||
]) // new green + blue + alpha channel
|
||||
.toColourspace(sharp.colourspace.srgb)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -54,9 +56,11 @@ describe('Image channel insertion', function () {
|
||||
it('Grayscale to RGBA, file', function (done) {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel), // new green channel
|
||||
.joinChannel([
|
||||
fs.readFileSync(fixtures.inputPngTestJoinChannel), // new green channel
|
||||
fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
||||
fs.readFileSync(fixtures.inputPngStripesV)]) // new alpha channel
|
||||
fs.readFileSync(fixtures.inputPngStripesV) // new alpha channel
|
||||
])
|
||||
.toColourspace('srgb')
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -70,9 +74,11 @@ describe('Image channel insertion', function () {
|
||||
it('Grayscale to CMYK, buffers', function (done) {
|
||||
sharp(fixtures.inputPng) // gray -> magenta
|
||||
.resize(320, 240)
|
||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel), // new cyan channel
|
||||
.joinChannel([
|
||||
fs.readFileSync(fixtures.inputPngTestJoinChannel), // new cyan channel
|
||||
fs.readFileSync(fixtures.inputPngStripesH), // new yellow channel
|
||||
fs.readFileSync(fixtures.inputPngStripesV)]) // new black channel
|
||||
fs.readFileSync(fixtures.inputPngStripesV) // new black channel
|
||||
])
|
||||
.toColorspace('cmyk')
|
||||
.toFormat('jpeg')
|
||||
.toBuffer(function (err, data, info) {
|
||||
@ -92,12 +98,13 @@ describe('Image channel insertion', function () {
|
||||
.then(function (buffers) {
|
||||
sharp(fixtures.inputPng)
|
||||
.resize(320, 240)
|
||||
.joinChannel(buffers,
|
||||
{ raw: {
|
||||
.joinChannel(buffers, {
|
||||
raw: {
|
||||
width: 320,
|
||||
height: 240,
|
||||
channels: 1
|
||||
}})
|
||||
}
|
||||
})
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
@ -115,8 +122,10 @@ describe('Image channel insertion', function () {
|
||||
sharp(fixtures.inputPng) // gray -> red
|
||||
.resize(320, 240)
|
||||
.joinChannel([fs.readFileSync(fixtures.inputPngTestJoinChannel)]) // new green channel
|
||||
.joinChannel([fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
||||
fs.readFileSync(fixtures.inputPngStripesV)]) // new alpha channel
|
||||
.joinChannel([
|
||||
fs.readFileSync(fixtures.inputPngStripesH), // new blue channel
|
||||
fs.readFileSync(fixtures.inputPngStripesV) // new alpha channel
|
||||
])
|
||||
.toColourspace('srgb')
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
@ -135,15 +144,13 @@ describe('Image channel insertion', function () {
|
||||
|
||||
it('Invalid input', function () {
|
||||
assert.throws(function () {
|
||||
sharp(fixtures.inputJpg)
|
||||
.joinChannel(1);
|
||||
sharp(fixtures.inputJpg).joinChannel(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('No arguments', function () {
|
||||
assert.throws(function () {
|
||||
sharp(fixtures.inputJpg)
|
||||
.joinChannel();
|
||||
sharp(fixtures.inputJpg).joinChannel();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user