Skip to content

Commit 0c938a9

Browse files
author
Steven Vancoillie
committed
fix: re-format with latest prettier version
1 parent 9f47e07 commit 0c938a9

39 files changed

+128
-134
lines changed

lib/components/aacdepay/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class AACDepay extends Tube {
4747
let AACPayloadType: number
4848
let hasHeader: boolean
4949

50-
const incoming = createTransform(function(
50+
const incoming = createTransform(function (
5151
msg: Message,
5252
encoding,
5353
callback,

lib/components/auth/digest.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export class DigestAuth {
4545

4646
const qop = params.get('qop')
4747
if (qop !== undefined) {
48-
const possibleQops = qop.split(',').map(qopType => qopType.trim())
49-
if (possibleQops.some(qopValue => qopValue === 'auth')) {
48+
const possibleQops = qop.split(',').map((qopType) => qopType.trim())
49+
if (possibleQops.some((qopValue) => qopValue === 'auth')) {
5050
this.qop = 'auth'
51-
} else if (possibleQops.some(qopValue => qopValue === 'auth-int')) {
51+
} else if (possibleQops.some((qopValue) => qopValue === 'auth-int')) {
5252
this.qop = 'auth-int'
5353
}
5454
}
@@ -66,7 +66,7 @@ export class DigestAuth {
6666
return new Array(4)
6767
.fill(0)
6868
.map(() => Math.floor(Math.random() * 256))
69-
.map(n => n.toString(16))
69+
.map((n) => n.toString(16))
7070
.join('')
7171
}
7272

lib/components/auth/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class Auth extends Tube {
3333
let lastSentMessage: RtspMessage
3434
let authHeader: string
3535

36-
const outgoing = createTransform(function(
36+
const outgoing = createTransform(function (
3737
msg: Message,
3838
encoding,
3939
callback,
@@ -48,7 +48,7 @@ export class Auth extends Tube {
4848
callback(undefined, msg)
4949
})
5050

51-
const incoming = createTransform(function(
51+
const incoming = createTransform(function (
5252
msg: Message,
5353
encoding,
5454
callback,
@@ -58,7 +58,7 @@ export class Auth extends Tube {
5858
statusCode(msg.data) === UNAUTHORIZED
5959
) {
6060
const headers = msg.data.toString().split('\n')
61-
const wwwAuth = headers.find(header => /WWW-Auth/i.test(header))
61+
const wwwAuth = headers.find((header) => /WWW-Auth/i.test(header))
6262
if (wwwAuth === undefined) {
6363
throw new Error('cannot find WWW-Authenticate header')
6464
}

lib/components/basicdepay/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class BasicDepay extends Tube {
1616

1717
let buffer = Buffer.alloc(0)
1818

19-
const incoming = createTransform(function(
19+
const incoming = createTransform(function (
2020
msg: Message,
2121
encoding,
2222
callback,

lib/components/canvas/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class CanvasSink extends Sink {
128128
info.renderedFrames++
129129
window
130130
.createImageBitmap(blob)
131-
.then(imageBitmap => {
131+
.then((imageBitmap) => {
132132
ctxBitmaprenderer.transferFromImageBitmap(imageBitmap)
133133
})
134134
.catch(() => {
@@ -249,7 +249,7 @@ export class CanvasSink extends Sink {
249249
// Set up an outgoing stream.
250250
const outgoing = new Readable({
251251
objectMode: true,
252-
read: function() {
252+
read: function () {
253253
//
254254
},
255255
})

lib/components/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ export class Source extends AbstractComponent {
106106
* to all previous streams (but not further than any endpoints). What happens
107107
* when an error is emitted on a stream is up to the stream's implementation.
108108
*/
109-
const incomingErrorHandler: ErrorEventHandler = err => {
109+
const incomingErrorHandler: ErrorEventHandler = (err) => {
110110
this.incoming.emit('error', err)
111111
}
112112
next.incoming.on('error', incomingErrorHandler)
113113

114-
const outgoingErrorHandler: ErrorEventHandler = err => {
114+
const outgoingErrorHandler: ErrorEventHandler = (err) => {
115115
next.outgoing.emit('error', err)
116116
}
117117
this.outgoing.on('error', outgoingErrorHandler)

lib/components/h264depay/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class H264Depay extends Tube {
1616

1717
const incoming = new Transform({
1818
objectMode: true,
19-
transform: function(msg: Message, encoding, callback) {
19+
transform: function (msg: Message, encoding, callback) {
2020
// Get correct payload types from sdp to identify video and audio
2121
if (msg.type === MessageType.SDP) {
2222
const h264Media = msg.sdp.media.find((media): media is VideoMedia => {

lib/components/helpers/sleep.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @return {Promise} Resolves after waiting time
55
*/
66
export const sleep = (ms: number) => {
7-
return new Promise(resolve => {
7+
return new Promise((resolve) => {
88
setTimeout(resolve, ms)
99
})
1010
}

lib/components/inspector/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class Inspector extends Tube {
3232

3333
const incoming = new Transform({
3434
objectMode: true,
35-
transform: function(msg, encoding, callback) {
35+
transform: function (msg, encoding, callback) {
3636
incomingLogger(msg)
3737
callback(undefined, msg)
3838
},
@@ -42,7 +42,7 @@ export class Inspector extends Tube {
4242

4343
const outgoing = new Transform({
4444
objectMode: true,
45-
transform: function(msg, encoding, callback) {
45+
transform: function (msg, encoding, callback) {
4646
outgoingLogger(msg)
4747
callback(undefined, msg)
4848
},

lib/components/jpegdepay/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class JPEGDepay extends Tube {
1515

1616
const incoming = new Transform({
1717
objectMode: true,
18-
transform: function(msg: Message, encoding, callback) {
18+
transform: function (msg: Message, encoding, callback) {
1919
if (msg.type === MessageType.SDP) {
2020
const jpegMedia = msg.sdp.media.find((media): media is VideoMedia => {
2121
return (

lib/components/mp4capture/index.test.ts

+19-19
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const MOCK_MOVIE_ENDING_DATA = 0xfe
1212
// We want to simulate the beginning and end of a movie, as well
1313
// as non-movie packets.
1414
const MOCK_MOVIE = [MessageType.SDP, MessageType.ISOM, MessageType.ISOM].map(
15-
type => {
15+
(type) => {
1616
return { type, data: Buffer.allocUnsafe(1).fill(MOCK_MOVIE_DATA) }
1717
},
1818
)
@@ -23,11 +23,11 @@ const MOCK_MOVIE_ENDING = [
2323
MessageType.ISOM,
2424
MessageType.ISOM,
2525
MessageType.ISOM,
26-
].map(type => {
26+
].map((type) => {
2727
return { type, data: Buffer.allocUnsafe(1).fill(MOCK_MOVIE_ENDING_DATA) }
2828
})
2929

30-
const MOCK_NOT_MOVIE = ['', ''].map(type => {
30+
const MOCK_NOT_MOVIE = ['', ''].map((type) => {
3131
return {
3232
type: (type as unknown) as MessageType, // Intentionally bad type for testing
3333
data: Buffer.allocUnsafe(1).fill(0),
@@ -36,8 +36,8 @@ const MOCK_NOT_MOVIE = ['', ''].map(type => {
3636

3737
const copySpies = (type: MessageType, messages: GenericMessage[]) => {
3838
return messages
39-
.filter(msg => msg.type === type)
40-
.map(msg => jest.spyOn(msg.data, 'copy'))
39+
.filter((msg) => msg.type === type)
40+
.map((msg) => jest.spyOn(msg.data, 'copy'))
4141
}
4242

4343
/**
@@ -69,7 +69,7 @@ describe('it should follow standard component rules', () => {
6969
})
7070

7171
describe('data copying', () => {
72-
test('should not occur when capture inactive', done => {
72+
test('should not occur when capture inactive', (done) => {
7373
const pipeline = pipelineFactory(MOCK_MOVIE)
7474

7575
// Spy on the copy method of the underlying movie data.
@@ -79,13 +79,13 @@ describe('data copying', () => {
7979
pipeline.flow()
8080

8181
pipeline.sink.incoming.on('finish', () => {
82-
shouldNotCopy.forEach(copy => expect(copy).not.toHaveBeenCalled())
82+
shouldNotCopy.forEach((copy) => expect(copy).not.toHaveBeenCalled())
8383
expect(pipeline.sinkHandler.mock.calls.length).toBe(MOCK_MOVIE.length)
8484
done()
8585
})
8686
})
8787

88-
test('should occur when capture active', done => {
88+
test('should occur when capture active', (done) => {
8989
const pipeline = pipelineFactory(MOCK_MOVIE)
9090

9191
// Spy on the copy method of the underlying movie data.
@@ -99,13 +99,13 @@ describe('data copying', () => {
9999
pipeline.flow()
100100

101101
pipeline.sink.incoming.on('finish', () => {
102-
shouldCopy.forEach(copy => expect(copy).toHaveBeenCalled())
102+
shouldCopy.forEach((copy) => expect(copy).toHaveBeenCalled())
103103
expect(captureHandler).toHaveBeenCalledWith(MOCK_MOVIE_BUFFER)
104104
done()
105105
})
106106
})
107107

108-
test('should only occur when new movie has started', done => {
108+
test('should only occur when new movie has started', (done) => {
109109
const pipeline = pipelineFactory(MOCK_MOVIE_ENDING, MOCK_MOVIE)
110110

111111
const shouldNotCopy = copySpies(MessageType.ISOM, MOCK_MOVIE_ENDING)
@@ -119,14 +119,14 @@ describe('data copying', () => {
119119
pipeline.flow()
120120

121121
pipeline.sink.incoming.on('finish', () => {
122-
shouldNotCopy.forEach(copy => expect(copy).not.toHaveBeenCalled())
123-
shouldCopy.forEach(copy => expect(copy).toHaveBeenCalled())
122+
shouldNotCopy.forEach((copy) => expect(copy).not.toHaveBeenCalled())
123+
shouldCopy.forEach((copy) => expect(copy).toHaveBeenCalled())
124124
expect(captureHandler).toHaveBeenCalledWith(MOCK_MOVIE_BUFFER)
125125
done()
126126
})
127127
})
128128

129-
test('should not occur when not a movie', done => {
129+
test('should not occur when not a movie', (done) => {
130130
const pipeline = pipelineFactory(MOCK_MOVIE, MOCK_NOT_MOVIE)
131131

132132
const shouldCopy = copySpies(MessageType.ISOM, MOCK_MOVIE)
@@ -140,14 +140,14 @@ describe('data copying', () => {
140140
pipeline.flow()
141141

142142
pipeline.sink.incoming.on('finish', () => {
143-
shouldCopy.forEach(copy => expect(copy).toHaveBeenCalled())
144-
shouldNotCopy.forEach(copy => expect(copy).not.toHaveBeenCalled())
143+
shouldCopy.forEach((copy) => expect(copy).toHaveBeenCalled())
144+
shouldNotCopy.forEach((copy) => expect(copy).not.toHaveBeenCalled())
145145
expect(captureHandler).toHaveBeenCalledWith(MOCK_MOVIE_BUFFER)
146146
done()
147147
})
148148
})
149149

150-
test('should stop when requested', done => {
150+
test('should stop when requested', (done) => {
151151
const pipeline = pipelineFactory(MOCK_MOVIE, MOCK_MOVIE_ENDING)
152152

153153
const shouldCopy = copySpies(MessageType.ISOM, MOCK_MOVIE)
@@ -156,7 +156,7 @@ describe('data copying', () => {
156156
// Activate capture.
157157
const captureHandler = jest.fn()
158158
pipeline.capture.start(captureHandler)
159-
pipeline.source.incoming.on('data', msg => {
159+
pipeline.source.incoming.on('data', (msg) => {
160160
if (msg.data[0] === 0xfe) {
161161
pipeline.capture.stop()
162162
}
@@ -166,8 +166,8 @@ describe('data copying', () => {
166166
pipeline.flow()
167167

168168
pipeline.sink.incoming.on('finish', () => {
169-
shouldCopy.forEach(copy => expect(copy).toHaveBeenCalled())
170-
shouldNotCopy.forEach(copy => expect(copy).not.toHaveBeenCalled())
169+
shouldCopy.forEach((copy) => expect(copy).toHaveBeenCalled())
170+
shouldNotCopy.forEach((copy) => expect(copy).not.toHaveBeenCalled())
171171
expect(captureHandler).toHaveBeenCalledWith(MOCK_MOVIE_BUFFER)
172172
done()
173173
})

lib/components/mp4muxer/helpers/boxbuilder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class BoxBuilder {
156156
let trackId = 0
157157
this.trackData = []
158158

159-
sdp.media.forEach(media => {
159+
sdp.media.forEach((media) => {
160160
if (media.rtpmap === undefined) {
161161
return
162162
}

lib/components/mp4muxer/helpers/isom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class UInt64BE extends BoxElement {
220220
* @param {Number} [sizeMask=0x00] A bit mask to use for the size.
221221
* @return {Class} An element type that groups parameter sets.
222222
*/
223-
const createParameterSetArrayClass = function(sizeMask = 0x00) {
223+
const createParameterSetArrayClass = function (sizeMask = 0x00) {
224224
return class ParameterSetArray extends BoxElement {
225225
public value: any[]
226226
/**

lib/components/mp4muxer/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class Mp4Muxer extends Tube {
2424
}
2525
const incoming = new Transform({
2626
objectMode: true,
27-
transform: function(msg: Message, encoding, callback) {
27+
transform: function (msg: Message, encoding, callback) {
2828
if (msg.type === MessageType.SDP) {
2929
/**
3030
* Arrival of SDP signals the beginning of a new movie.
@@ -111,14 +111,14 @@ export class Mp4Muxer extends Tube {
111111
get bitrate() {
112112
return (
113113
this.boxBuilder.trackData &&
114-
this.boxBuilder.trackData.map(data => data.bitrate)
114+
this.boxBuilder.trackData.map((data) => data.bitrate)
115115
)
116116
}
117117

118118
get framerate() {
119119
return (
120120
this.boxBuilder.trackData &&
121-
this.boxBuilder.trackData.map(data => data.framerate)
121+
this.boxBuilder.trackData.map((data) => data.framerate)
122122
)
123123
}
124124

lib/components/mse/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class MseSink extends Sink {
4747

4848
// Set up a list of tracks that contain info about
4949
// the type of media, encoding, and codec are present.
50-
const tracks = msg.sdp.media.map(media => {
50+
const tracks = msg.sdp.media.map((media) => {
5151
return {
5252
type: media.type,
5353
encoding: media.rtpmap && media.rtpmap.encodingName,
@@ -65,8 +65,8 @@ export class MseSink extends Sink {
6565
mse.removeEventListener('sourceopen', handler)
6666
this.onSourceOpen && this.onSourceOpen(mse, tracks)
6767
const mimeCodecs = tracks
68-
.map(track => track.mime)
69-
.filter(mime => mime)
68+
.map((track) => track.mime)
69+
.filter((mime) => mime)
7070
.join(', ')
7171
sourceBuffer = this.addSourceBuffer(
7272
el,
@@ -120,7 +120,7 @@ export class MseSink extends Sink {
120120
*/
121121
const outgoing = new Readable({
122122
objectMode: true,
123-
read: function() {
123+
read: function () {
124124
//
125125
},
126126
})

lib/components/onvifdepay/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ONVIFDepay extends Tube {
1515

1616
const incoming = new Transform({
1717
objectMode: true,
18-
transform: function(msg: Message, encoding, callback) {
18+
transform: function (msg: Message, encoding, callback) {
1919
if (msg.type === MessageType.SDP) {
2020
let validMedia
2121
for (const media of msg.sdp.media) {

lib/components/recorder/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const fakeStorage = jest.fn()
77
const recorder = new Recorder(StreamFactory.consumer(fakeStorage))
88
runComponentTests(recorder, 'websocket component')
99

10-
test('recorder saves data', done => {
10+
test('recorder saves data', (done) => {
1111
const fakeStorage = jest.fn()
1212
const recorder = new Recorder(StreamFactory.consumer(fakeStorage))
1313

@@ -22,7 +22,7 @@ test('recorder saves data', done => {
2222
// Wait for stream to end, then check what has happened.
2323
sink.incoming.on('finish', () => {
2424
expect(logger).toHaveBeenCalledTimes(send.length)
25-
const receive = logger.mock.calls.map(args => args[0])
25+
const receive = logger.mock.calls.map((args) => args[0])
2626
expect(send).toEqual(receive)
2727
done()
2828
})

lib/components/recorder/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class Recorder extends Tube {
2424
const streamsFinished = []
2525
for (const [key, value] of Object.entries(interleaved)) {
2626
streamsFinished.push(
27-
new Promise(resolve =>
27+
new Promise((resolve) =>
2828
value.on('finish', () => {
2929
const timestamp = Date.now()
3030
const message = null

0 commit comments

Comments
 (0)