Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f51330

Browse files
authored
Apply suggestions from code review
1 parent dcdecf9 commit 1f51330

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export interface RawImageData<T> {
22
width: number;
33
height: number;
44
data: T;
5-
comments?: string[];
65
}
76

87
type BufferRet = RawImageData<Buffer>;
@@ -11,7 +10,7 @@ type UintArrRet = RawImageData<Uint8Array>;
1110
type ImageData = BufferRet | UintArrRet;
1211
type BufferLike = Buffer | Uint8Array | ArrayLike<number> | Iterable<number> | ArrayBuffer;
1312

14-
export declare function encode(imgData: RawImageData<BufferLike>, quality?: number): BufferRet & {comments?: string[]};
13+
export declare function encode(imgData: RawImageData<BufferLike> & {comments?: string[]}, quality?: number): BufferRet
1514

1615
export declare function decode(
1716
jpegData: BufferLike,

lib/encoder.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ function encode(imgData, qu) {
798798
data: data,
799799
width: imgData.width,
800800
height: imgData.height,
801-
comments: imgData.comments
802801
};
803802
}
804803

test/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ it('should be able to create a JPEG from an array with comment', function () {
202202
expect(jpegImageData.height).toEqual(height);
203203
var expected = fixture('redbox_comment.jpg');
204204
expect(jpegImageData.data).toEqual(expected);
205+
expect(jpeg.decode(jpegImageData.data).comments).toEqual(['First comment', 'second comment']);
205206
});
206207

207208
it('should be able to decode a JPEG into a typed array', function () {

0 commit comments

Comments
 (0)