Skip to content

Commit e9b5697

Browse files
committed
Update prettier to version 2.
1 parent e616c47 commit e9b5697

File tree

4 files changed

+37
-35
lines changed

4 files changed

+37
-35
lines changed

js/canvas-to-blob.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
/* global define, Uint8Array, ArrayBuffer, module */
1616

17-
;(function(window) {
17+
;(function (window) {
1818
'use strict'
1919

2020
var CanvasPrototype =
2121
window.HTMLCanvasElement && window.HTMLCanvasElement.prototype
2222
var hasBlobConstructor =
2323
window.Blob &&
24-
(function() {
24+
(function () {
2525
try {
2626
return Boolean(new Blob())
2727
} catch (e) {
@@ -31,7 +31,7 @@
3131
var hasArrayBufferViewSupport =
3232
hasBlobConstructor &&
3333
window.Uint8Array &&
34-
(function() {
34+
(function () {
3535
try {
3636
return new Blob([new Uint8Array(100)]).size === 100
3737
} catch (e) {
@@ -49,7 +49,7 @@
4949
window.atob &&
5050
window.ArrayBuffer &&
5151
window.Uint8Array &&
52-
function(dataURI) {
52+
function (dataURI) {
5353
var matches,
5454
mediaType,
5555
isBase64,
@@ -95,9 +95,9 @@
9595
}
9696
if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {
9797
if (CanvasPrototype.mozGetAsFile) {
98-
CanvasPrototype.toBlob = function(callback, type, quality) {
98+
CanvasPrototype.toBlob = function (callback, type, quality) {
9999
var self = this
100-
setTimeout(function() {
100+
setTimeout(function () {
101101
if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {
102102
callback(dataURLtoBlob(self.toDataURL(type, quality)))
103103
} else {
@@ -106,16 +106,16 @@
106106
})
107107
}
108108
} else if (CanvasPrototype.toDataURL && dataURLtoBlob) {
109-
CanvasPrototype.toBlob = function(callback, type, quality) {
109+
CanvasPrototype.toBlob = function (callback, type, quality) {
110110
var self = this
111-
setTimeout(function() {
111+
setTimeout(function () {
112112
callback(dataURLtoBlob(self.toDataURL(type, quality)))
113113
})
114114
}
115115
}
116116
}
117117
if (typeof define === 'function' && define.amd) {
118-
define(function() {
118+
define(function () {
119119
return dataURLtoBlob
120120
})
121121
} else if (typeof module === 'object' && module.exports) {

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"eslint-config-prettier": "6",
2727
"eslint-plugin-jsdoc": "22",
2828
"eslint-plugin-prettier": "3",
29-
"prettier": "1",
29+
"prettier": "2",
3030
"uglify-js": "3"
3131
},
3232
"eslintConfig": {
@@ -44,9 +44,11 @@
4444
"test/vendor"
4545
],
4646
"prettier": {
47+
"arrowParens": "avoid",
4748
"proseWrap": "always",
4849
"semi": false,
49-
"singleQuote": true
50+
"singleQuote": true,
51+
"trailingComma": "none"
5052
},
5153
"scripts": {
5254
"lint": "eslint .",

test/test.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
/* global describe, it, chai, dataURLtoBlob */
1313

14-
;(function() {
14+
;(function () {
1515
'use strict'
1616

1717
var expect = chai.expect
18-
var canvasToBlob = function(canvas, callback, type, quality) {
19-
setTimeout(function() {
18+
var canvasToBlob = function (canvas, callback, type, quality) {
19+
setTimeout(function () {
2020
callback(dataURLtoBlob(canvas.toDataURL(type, quality)))
2121
})
2222
}
@@ -29,12 +29,12 @@
2929
var imageUrl = 'data:image/gif;base64,' + b64Data
3030
var blob = dataURLtoBlob(imageUrl)
3131

32-
describe('canvas.toBlob', function() {
33-
it('Converts a canvas element to a blob and passes it to the callback function', function(done) {
32+
describe('canvas.toBlob', function () {
33+
it('Converts a canvas element to a blob and passes it to the callback function', function (done) {
3434
window.loadImage(
3535
blob,
36-
function(canvas) {
37-
canvasToBlob(canvas, function(newBlob) {
36+
function (canvas) {
37+
canvasToBlob(canvas, function (newBlob) {
3838
expect(newBlob).to.be.a.instanceOf(Blob)
3939
done()
4040
})
@@ -43,13 +43,13 @@
4343
)
4444
})
4545

46-
it('Converts a canvas element to a PNG blob', function(done) {
46+
it('Converts a canvas element to a PNG blob', function (done) {
4747
window.loadImage(
4848
blob,
49-
function(canvas) {
49+
function (canvas) {
5050
canvasToBlob(
5151
canvas,
52-
function(newBlob) {
52+
function (newBlob) {
5353
expect(newBlob.type).to.equal('image/png')
5454
done()
5555
},
@@ -60,13 +60,13 @@
6060
)
6161
})
6262

63-
it('Converts a canvas element to a JPG blob', function(done) {
63+
it('Converts a canvas element to a JPG blob', function (done) {
6464
window.loadImage(
6565
blob,
66-
function(canvas) {
66+
function (canvas) {
6767
canvasToBlob(
6868
canvas,
69-
function(newBlob) {
69+
function (newBlob) {
7070
expect(newBlob.type).to.equal('image/jpeg')
7171
done()
7272
},
@@ -77,12 +77,12 @@
7777
)
7878
})
7979

80-
it('Keeps the aspect ratio of the canvas image', function(done) {
80+
it('Keeps the aspect ratio of the canvas image', function (done) {
8181
window.loadImage(
8282
blob,
83-
function(canvas) {
84-
canvasToBlob(canvas, function(newBlob) {
85-
window.loadImage(newBlob, function(img) {
83+
function (canvas) {
84+
canvasToBlob(canvas, function (newBlob) {
85+
window.loadImage(newBlob, function (img) {
8686
expect(img.width).to.equal(canvas.width)
8787
expect(img.height).to.equal(canvas.height)
8888
done()
@@ -93,14 +93,14 @@
9393
)
9494
})
9595

96-
it('Keeps the image data of the canvas image', function(done) {
96+
it('Keeps the image data of the canvas image', function (done) {
9797
window.loadImage(
9898
blob,
99-
function(canvas) {
100-
canvasToBlob(canvas, function(newBlob) {
99+
function (canvas) {
100+
canvasToBlob(canvas, function (newBlob) {
101101
window.loadImage(
102102
newBlob,
103-
function(newCanvas) {
103+
function (newCanvas) {
104104
var canvasData = canvas
105105
.getContext('2d')
106106
.getImageData(0, 0, canvas.width, canvas.height)

0 commit comments

Comments
 (0)