@neurodevs/node-lsl 8.0.1 → 8.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.vscode/settings.json +17 -20
  2. package/build/.spruce/errors/errors.types.js +0 -2
  3. package/build/.spruce/errors/errors.types.js.map +1 -1
  4. package/build/__tests__/behavioral/LslOutlet.test.js +9 -14
  5. package/build/__tests__/behavioral/LslOutlet.test.js.map +1 -1
  6. package/build/__tests__/behavioral/TimeMarkerOutlet.test.js.map +1 -1
  7. package/build/__tests__/implementation/Liblsl.test.js +17 -4
  8. package/build/__tests__/implementation/Liblsl.test.js.map +1 -1
  9. package/build/__tests__/support/consts.js.map +1 -1
  10. package/build/__tests__/support/generateRandomOutletOptions.js.map +1 -1
  11. package/build/assertions.js.map +1 -1
  12. package/build/consts.js.map +1 -1
  13. package/build/errors/SpruceError.d.ts +1 -1
  14. package/build/errors/SpruceError.js.map +1 -1
  15. package/build/errors/failedToLoadLiblsl.builder.js.map +1 -1
  16. package/build/implementations/Liblsl.js +22 -6
  17. package/build/implementations/Liblsl.js.map +1 -1
  18. package/build/implementations/LslOutlet.js +6 -14
  19. package/build/implementations/LslOutlet.js.map +1 -1
  20. package/build/implementations/TimeMarkerOutlet.js +4 -1
  21. package/build/implementations/TimeMarkerOutlet.js.map +1 -1
  22. package/build/nodeLsl.types.d.ts +2 -2
  23. package/build/testDoubles/FakeLiblsl.js.map +1 -1
  24. package/build/testDoubles/MockTimeMarkerOutlet.js.map +1 -1
  25. package/build/testDoubles/SpyExtendsTimeMarkerOutlet.js.map +1 -1
  26. package/build/testDoubles/SpyImplementsTimeMarkerOutlet.js.map +1 -1
  27. package/build/validations.js.map +1 -1
  28. package/eslint.config.mjs +3 -0
  29. package/package.json +26 -26
  30. package/src/.spruce/errors/errors.types.ts +0 -3
  31. package/src/__tests__/behavioral/LslOutlet.test.ts +272 -267
  32. package/src/__tests__/behavioral/TimeMarkerOutlet.test.ts +144 -141
  33. package/src/__tests__/implementation/Liblsl.test.ts +461 -438
  34. package/src/__tests__/support/consts.ts +22 -22
  35. package/src/__tests__/support/generateRandomOutletOptions.ts +13 -13
  36. package/src/assertions.ts +39 -39
  37. package/src/consts.ts +16 -16
  38. package/src/errors/SpruceError.ts +16 -16
  39. package/src/errors/failedToLoadLiblsl.builder.ts +8 -8
  40. package/src/implementations/Liblsl.ts +205 -181
  41. package/src/implementations/LslOutlet.ts +114 -114
  42. package/src/implementations/TimeMarkerOutlet.ts +50 -50
  43. package/src/nodeLsl.types.ts +60 -63
  44. package/src/testDoubles/FakeLiblsl.ts +58 -56
  45. package/src/testDoubles/MockTimeMarkerOutlet.ts +56 -56
  46. package/src/testDoubles/SpyExtendsTimeMarkerOutlet.ts +11 -11
  47. package/src/testDoubles/SpyImplementsTimeMarkerOutlet.ts +28 -28
  48. package/src/validations.ts +6 -6
  49. package/tsconfig.json +3 -4
  50. package/.eslintignore +0 -3
  51. package/.eslintrc.js +0 -3
@@ -1,67 +1,67 @@
1
1
  import {
2
- TimeMarkerOutlet,
3
- LslOutletOptions,
4
- DurationMarker,
5
- TimeMarkerOutletConstructor,
2
+ TimeMarkerOutlet,
3
+ LslOutletOptions,
4
+ DurationMarker,
5
+ TimeMarkerOutletConstructor,
6
6
  } from '../nodeLsl.types'
7
7
  import LslOutletImpl from './LslOutlet'
8
8
 
9
9
  export default class TimeMarkerOutletImpl
10
- extends LslOutletImpl
11
- implements TimeMarkerOutlet
10
+ extends LslOutletImpl
11
+ implements TimeMarkerOutlet
12
12
  {
13
- public static Class?: TimeMarkerOutletConstructor
13
+ public static Class?: TimeMarkerOutletConstructor
14
14
 
15
- private isPlaying: boolean = false
16
- private waitResolve?: () => void
17
- private timeout?: any
15
+ private isPlaying = false
16
+ private waitResolve?: () => void
17
+ private timeout?: any
18
18
 
19
- public static Outlet(options?: Partial<LslOutletOptions>) {
20
- const defaultOptions = {
21
- name: 'Time markers',
22
- type: 'Markers',
23
- channelNames: ['Markers'],
24
- sampleRate: 0,
25
- channelFormat: 'string',
26
- sourceId: 'time-markers',
27
- manufacturer: 'N/A',
28
- unit: 'N/A',
29
- chunkSize: 0,
30
- maxBuffered: 0,
31
- } as LslOutletOptions
19
+ public static Outlet(options?: Partial<LslOutletOptions>) {
20
+ const defaultOptions = {
21
+ name: 'Time markers',
22
+ type: 'Markers',
23
+ channelNames: ['Markers'],
24
+ sampleRate: 0,
25
+ channelFormat: 'string',
26
+ sourceId: 'time-markers',
27
+ manufacturer: 'N/A',
28
+ unit: 'N/A',
29
+ chunkSize: 0,
30
+ maxBuffered: 0,
31
+ } as LslOutletOptions
32
32
 
33
- return new (this.Class ?? this)({
34
- ...defaultOptions,
35
- ...options,
36
- }) as TimeMarkerOutlet
37
- }
33
+ return new (this.Class ?? this)({
34
+ ...defaultOptions,
35
+ ...options,
36
+ }) as TimeMarkerOutlet
37
+ }
38
38
 
39
- public async pushMarkers(markers: DurationMarker[]) {
40
- this.isPlaying = true
39
+ public async pushMarkers(markers: DurationMarker[]) {
40
+ this.isPlaying = true
41
41
 
42
- for (let marker of markers) {
43
- this.pushSample([marker.name])
42
+ for (let marker of markers) {
43
+ this.pushSample([marker.name])
44
44
 
45
- await this.wait(marker.durationMs)
45
+ await this.wait(marker.durationMs)
46
46
 
47
- if (!this.isPlaying) {
48
- return
49
- }
50
- }
51
- }
47
+ if (!this.isPlaying) {
48
+ return
49
+ }
50
+ }
51
+ }
52
52
 
53
- protected async wait(durationMs: number) {
54
- return new Promise((resolve) => this.setTimeout(resolve, durationMs))
55
- }
53
+ protected async wait(durationMs: number) {
54
+ return new Promise((resolve) => this.setTimeout(resolve, durationMs))
55
+ }
56
56
 
57
- private setTimeout(resolve: (value: unknown) => void, durationMs: number) {
58
- this.waitResolve = resolve as any
59
- this.timeout = setTimeout(resolve, durationMs)
60
- }
57
+ private setTimeout(resolve: (value: unknown) => void, durationMs: number) {
58
+ this.waitResolve = resolve as any
59
+ this.timeout = setTimeout(resolve, durationMs)
60
+ }
61
61
 
62
- public stop() {
63
- this.waitResolve?.()
64
- clearTimeout(this.timeout)
65
- this.isPlaying = false
66
- }
62
+ public stop() {
63
+ this.waitResolve?.()
64
+ clearTimeout(this.timeout)
65
+ this.isPlaying = false
66
+ }
67
67
  }
@@ -1,113 +1,113 @@
1
- import { FFIParams } from 'ffi-rs'
1
+ import { FuncObj, FieldType } from 'ffi-rs'
2
2
  import { CHANNEL_FORMATS } from './consts'
3
3
 
4
4
  export interface LslOutlet {
5
- destroy(): void
6
- pushSample(sample: LslSample): void
5
+ destroy(): void
6
+ pushSample(sample: LslSample): void
7
7
  }
8
8
 
9
9
  export interface LslOutletOptions {
10
- name: string
11
- type: string
12
- channelNames: string[]
13
- sampleRate: number
14
- channelFormat: ChannelFormat
15
- sourceId: string
16
- manufacturer: string
17
- unit: string
18
- chunkSize: number
19
- maxBuffered: number
10
+ name: string
11
+ type: string
12
+ channelNames: string[]
13
+ sampleRate: number
14
+ channelFormat: ChannelFormat
15
+ sourceId: string
16
+ manufacturer: string
17
+ unit: string
18
+ chunkSize: number
19
+ maxBuffered: number
20
20
  }
21
21
 
22
22
  export type ChannelFormat = (typeof CHANNEL_FORMATS)[number]
23
23
 
24
24
  export interface TimeMarkerOutlet extends LslOutlet {
25
- pushMarkers(markers: DurationMarker[]): Promise<void>
26
- stop(): void
25
+ pushMarkers(markers: DurationMarker[]): Promise<void>
26
+ stop(): void
27
27
  }
28
28
 
29
29
  export type TimeMarkerOutletConstructor = new (
30
- options: LslOutletOptions
30
+ options: LslOutletOptions
31
31
  ) => TimeMarkerOutlet
32
32
 
33
33
  export interface DurationMarker {
34
- name: string
35
- durationMs: number
34
+ name: string
35
+ durationMs: number
36
36
  }
37
37
 
38
38
  export interface Liblsl {
39
- createStreamInfo(options: CreateStreamInfoOptions): BoundStreamInfo
40
- appendChannelsToStreamInfo(options: AppendChannelsToStreamInfoOptions): void
41
- createOutlet(options: CreateOutletOptions): BoundOutlet
42
- destroyOutlet(options: DestroyOutletOptions): void
43
- pushSampleFloatTimestamp(options: PushSampleFloatTimestampOptions): void
44
- pushSampleStringTimestamp(options: PushSampleStringTimestampOptions): void
45
- localClock(): number
39
+ createStreamInfo(options: CreateStreamInfoOptions): BoundStreamInfo
40
+ appendChannelsToStreamInfo(options: AppendChannelsToStreamInfoOptions): void
41
+ createOutlet(options: CreateOutletOptions): BoundOutlet
42
+ destroyOutlet(options: DestroyOutletOptions): void
43
+ pushSampleFloatTimestamp(options: PushSampleFloatTimestampOptions): void
44
+ pushSampleStringTimestamp(options: PushSampleStringTimestampOptions): void
45
+ localClock(): number
46
46
  }
47
47
 
48
48
  export interface CreateStreamInfoOptions {
49
- name: string
50
- type: string
51
- channelCount: number
52
- sampleRate: number
53
- channelFormat: number
54
- sourceId: string
55
- manufacturer?: string
56
- unit?: string
49
+ name: string
50
+ type: string
51
+ channelCount: number
52
+ sampleRate: number
53
+ channelFormat: number
54
+ sourceId: string
55
+ manufacturer?: string
56
+ unit?: string
57
57
  }
58
58
 
59
59
  export interface AppendChannelsToStreamInfoOptions {
60
- info: BoundStreamInfo
61
- channels: LslChannel[]
60
+ info: BoundStreamInfo
61
+ channels: LslChannel[]
62
62
  }
63
63
 
64
64
  export interface CreateOutletOptions {
65
- info: BoundStreamInfo
66
- chunkSize: number
67
- maxBuffered: number
65
+ info: BoundStreamInfo
66
+ chunkSize: number
67
+ maxBuffered: number
68
68
  }
69
69
 
70
70
  export interface DestroyOutletOptions {
71
- outlet: BoundOutlet
71
+ outlet: BoundOutlet
72
72
  }
73
73
 
74
74
  export interface PushSampleFloatTimestampOptions {
75
- outlet: BoundOutlet
76
- sample: number[]
77
- timestamp: number
75
+ outlet: BoundOutlet
76
+ sample: number[]
77
+ timestamp: number
78
78
  }
79
79
 
80
80
  export interface PushSampleStringTimestampOptions {
81
- outlet: BoundOutlet
82
- sample: string[]
83
- timestamp: number
81
+ outlet: BoundOutlet
82
+ sample: string[]
83
+ timestamp: number
84
84
  }
85
85
 
86
86
  export interface LslChannel {
87
- label: string
88
- unit: string
89
- type: string
87
+ label: string
88
+ unit: string
89
+ type: string
90
90
  }
91
91
 
92
92
  export type LslSample = (number | string | undefined)[]
93
93
 
94
94
  export interface LiblslBindings {
95
- lsl_create_streaminfo(
96
- options: [string, string, number, number, number, string]
97
- ): BoundStreamInfo
95
+ lsl_create_streaminfo(
96
+ options: [string, string, number, number, number, string]
97
+ ): BoundStreamInfo
98
98
 
99
- lsl_create_outlet(options: [BoundStreamInfo, number, number]): BoundOutlet
99
+ lsl_create_outlet(options: [BoundStreamInfo, number, number]): BoundOutlet
100
100
 
101
- lsl_destroy_outlet(outlet: [BoundOutlet]): void
101
+ lsl_destroy_outlet(outlet: [BoundOutlet]): void
102
102
 
103
- lsl_push_sample_ft(options: [BoundOutlet, LslSample, number]): void
103
+ lsl_push_sample_ft(options: [BoundOutlet, LslSample, number]): void
104
104
 
105
- lsl_push_sample_strt(options: [BoundOutlet, LslSample, number]): void
105
+ lsl_push_sample_strt(options: [BoundOutlet, LslSample, number]): void
106
106
 
107
- lsl_local_clock(options: []): number
108
- lsl_get_desc(info: [BoundStreamInfo]): BoundDescription
109
- lsl_append_child(options: [BoundDescription, string]): BoundChild
110
- lsl_append_child_value(options: [BoundChild, string, string]): void
107
+ lsl_local_clock(options: []): number
108
+ lsl_get_desc(info: [BoundStreamInfo]): BoundDescription
109
+ lsl_append_child(options: [BoundDescription, string]): BoundChild
110
+ lsl_append_child_value(options: [BoundChild, string, string]): void
111
111
  }
112
112
 
113
113
  export interface BoundStreamInfo {}
@@ -115,7 +115,4 @@ export interface BoundOutlet {}
115
115
  export interface BoundDescription {}
116
116
  export interface BoundChild {}
117
117
 
118
- export type FfiRsDefineOptions = Record<
119
- string,
120
- Omit<FFIParams<any>, 'funcName' | 'paramsValue'>
121
- >
118
+ export type FfiRsDefineOptions = FuncObj<FieldType, boolean | undefined>
@@ -1,61 +1,63 @@
1
1
  import {
2
- BoundOutlet,
3
- BoundStreamInfo,
4
- CreateStreamInfoOptions,
5
- AppendChannelsToStreamInfoOptions,
6
- CreateOutletOptions,
7
- PushSampleFloatTimestampOptions,
8
- PushSampleStringTimestampOptions,
9
- Liblsl,
2
+ BoundOutlet,
3
+ BoundStreamInfo,
4
+ CreateStreamInfoOptions,
5
+ AppendChannelsToStreamInfoOptions,
6
+ CreateOutletOptions,
7
+ PushSampleFloatTimestampOptions,
8
+ PushSampleStringTimestampOptions,
9
+ Liblsl,
10
10
  } from '../nodeLsl.types'
11
11
 
12
12
  export default class FakeLiblsl implements Liblsl {
13
- public outlet: BoundOutlet = {} as BoundOutlet
14
- public streamInfo: BoundStreamInfo = {} as BoundStreamInfo
15
-
16
- public lastCreateStreamInfoOptions?: CreateStreamInfoOptions
17
- public lastAppendChannelsToStreamInfoOptions?: AppendChannelsToStreamInfoOptions
18
- public lastCreateOutletOptions?: CreateOutletOptions
19
- public lastPushSampleFloatTimestampOptions?: PushSampleFloatTimestampOptions
20
- public lastPushSampleStringTimestampOptions?: PushSampleStringTimestampOptions
21
-
22
- public createStreamInfoHitCount = 0
23
- public destroyOutletHitCount = 0
24
- public localClockHitCount = 0
25
- public pushSampleStringTimestampHitCount = 0
26
-
27
- public createStreamInfo(options: CreateStreamInfoOptions) {
28
- this.createStreamInfoHitCount++
29
- this.lastCreateStreamInfoOptions = options
30
- return this.streamInfo
31
- }
32
-
33
- public appendChannelsToStreamInfo(
34
- options: AppendChannelsToStreamInfoOptions
35
- ) {
36
- this.lastAppendChannelsToStreamInfoOptions = options
37
- }
38
-
39
- public createOutlet(options: CreateOutletOptions) {
40
- this.lastCreateOutletOptions = options
41
- return this.outlet
42
- }
43
-
44
- public destroyOutlet() {
45
- this.destroyOutletHitCount++
46
- }
47
-
48
- public pushSampleFloatTimestamp(options: PushSampleFloatTimestampOptions) {
49
- this.lastPushSampleFloatTimestampOptions = options
50
- }
51
-
52
- public pushSampleStringTimestamp(options: PushSampleStringTimestampOptions) {
53
- this.lastPushSampleStringTimestampOptions = options
54
- this.pushSampleStringTimestampHitCount++
55
- }
56
-
57
- public localClock() {
58
- this.localClockHitCount++
59
- return new Date().getTime()
60
- }
13
+ public outlet: BoundOutlet = {} as BoundOutlet
14
+ public streamInfo: BoundStreamInfo = {} as BoundStreamInfo
15
+
16
+ public lastCreateStreamInfoOptions?: CreateStreamInfoOptions
17
+ public lastAppendChannelsToStreamInfoOptions?: AppendChannelsToStreamInfoOptions
18
+ public lastCreateOutletOptions?: CreateOutletOptions
19
+ public lastPushSampleFloatTimestampOptions?: PushSampleFloatTimestampOptions
20
+ public lastPushSampleStringTimestampOptions?: PushSampleStringTimestampOptions
21
+
22
+ public createStreamInfoHitCount = 0
23
+ public destroyOutletHitCount = 0
24
+ public localClockHitCount = 0
25
+ public pushSampleStringTimestampHitCount = 0
26
+
27
+ public createStreamInfo(options: CreateStreamInfoOptions) {
28
+ this.createStreamInfoHitCount++
29
+ this.lastCreateStreamInfoOptions = options
30
+ return this.streamInfo
31
+ }
32
+
33
+ public appendChannelsToStreamInfo(
34
+ options: AppendChannelsToStreamInfoOptions
35
+ ) {
36
+ this.lastAppendChannelsToStreamInfoOptions = options
37
+ }
38
+
39
+ public createOutlet(options: CreateOutletOptions) {
40
+ this.lastCreateOutletOptions = options
41
+ return this.outlet
42
+ }
43
+
44
+ public destroyOutlet() {
45
+ this.destroyOutletHitCount++
46
+ }
47
+
48
+ public pushSampleFloatTimestamp(options: PushSampleFloatTimestampOptions) {
49
+ this.lastPushSampleFloatTimestampOptions = options
50
+ }
51
+
52
+ public pushSampleStringTimestamp(
53
+ options: PushSampleStringTimestampOptions
54
+ ) {
55
+ this.lastPushSampleStringTimestampOptions = options
56
+ this.pushSampleStringTimestampHitCount++
57
+ }
58
+
59
+ public localClock() {
60
+ this.localClockHitCount++
61
+ return new Date().getTime()
62
+ }
61
63
  }
@@ -2,60 +2,60 @@ import { assert } from '@sprucelabs/test-utils'
2
2
  import { DurationMarker, LslSample, TimeMarkerOutlet } from '..'
3
3
 
4
4
  export default class MockTimeMarkerOutlet implements TimeMarkerOutlet {
5
- private didPushMarkers = false
6
- private pushedMarkers?: DurationMarker[]
7
- private didPushSamples = false
8
- private pushedSamples?: LslSample[]
9
-
10
- public stop() {}
11
- public destroy() {}
12
-
13
- public pushSample(sample: LslSample) {
14
- if (!this.didPushSamples) {
15
- this.didPushSamples = true
16
- this.pushedSamples = []
17
- }
18
- this.pushedSamples?.push(sample)
19
- }
20
-
21
- public async pushMarkers(markers: DurationMarker[]) {
22
- this.didPushMarkers = true
23
- this.pushedMarkers = markers
24
- }
25
-
26
- public assertDidPushSamples(samples?: LslSample[]) {
27
- assert.isTrue(
28
- this.didPushSamples,
29
- `Expected to have pushed samples but didn't. Try 'outlet.pushSample(...)'`
30
- )
31
-
32
- if (samples) {
33
- assert.isEqualDeep(this.pushedSamples, samples)
34
- }
35
- }
36
-
37
- public assertDidNotPushSamples() {
38
- assert.isFalse(
39
- this.didPushSamples,
40
- `Expected to NOT have pushed samples but did. Try 'outlet.pushSample(...)'`
41
- )
42
- }
43
-
44
- public assertDidPushMarkers(markers?: DurationMarker[]) {
45
- assert.isTrue(
46
- this.didPushMarkers,
47
- `Expected to have pushed markers but didn't. Try 'outlet.pushMarkers(...)'`
48
- )
49
-
50
- if (markers) {
51
- assert.isEqualDeep(this.pushedMarkers, markers)
52
- }
53
- }
54
-
55
- public assertDidNotPushMarkers() {
56
- assert.isFalse(
57
- this.didPushMarkers,
58
- `Expected to NOT have pushed markers but did. Try 'outlet.pushMarkers(...)'`
59
- )
60
- }
5
+ private didPushMarkers = false
6
+ private pushedMarkers?: DurationMarker[]
7
+ private didPushSamples = false
8
+ private pushedSamples?: LslSample[]
9
+
10
+ public stop() {}
11
+ public destroy() {}
12
+
13
+ public pushSample(sample: LslSample) {
14
+ if (!this.didPushSamples) {
15
+ this.didPushSamples = true
16
+ this.pushedSamples = []
17
+ }
18
+ this.pushedSamples?.push(sample)
19
+ }
20
+
21
+ public async pushMarkers(markers: DurationMarker[]) {
22
+ this.didPushMarkers = true
23
+ this.pushedMarkers = markers
24
+ }
25
+
26
+ public assertDidPushSamples(samples?: LslSample[]) {
27
+ assert.isTrue(
28
+ this.didPushSamples,
29
+ `Expected to have pushed samples but didn't. Try 'outlet.pushSample(...)'`
30
+ )
31
+
32
+ if (samples) {
33
+ assert.isEqualDeep(this.pushedSamples, samples)
34
+ }
35
+ }
36
+
37
+ public assertDidNotPushSamples() {
38
+ assert.isFalse(
39
+ this.didPushSamples,
40
+ `Expected to NOT have pushed samples but did. Try 'outlet.pushSample(...)'`
41
+ )
42
+ }
43
+
44
+ public assertDidPushMarkers(markers?: DurationMarker[]) {
45
+ assert.isTrue(
46
+ this.didPushMarkers,
47
+ `Expected to have pushed markers but didn't. Try 'outlet.pushMarkers(...)'`
48
+ )
49
+
50
+ if (markers) {
51
+ assert.isEqualDeep(this.pushedMarkers, markers)
52
+ }
53
+ }
54
+
55
+ public assertDidNotPushMarkers() {
56
+ assert.isFalse(
57
+ this.didPushMarkers,
58
+ `Expected to NOT have pushed markers but did. Try 'outlet.pushMarkers(...)'`
59
+ )
60
+ }
61
61
  }
@@ -2,17 +2,17 @@ import TimeMarkerOutletImpl from '../implementations/TimeMarkerOutlet'
2
2
  import { LslOutletOptions } from '../nodeLsl.types'
3
3
 
4
4
  export default class SpyExtendsTimeMarkerOutlet extends TimeMarkerOutletImpl {
5
- public spyOptions: LslOutletOptions
6
- public totalWaitTimeMs: number
5
+ public spyOptions: LslOutletOptions
6
+ public totalWaitTimeMs: number
7
7
 
8
- public constructor(options: LslOutletOptions) {
9
- super(options)
10
- this.spyOptions = options
11
- this.totalWaitTimeMs = 0
12
- }
8
+ public constructor(options: LslOutletOptions) {
9
+ super(options)
10
+ this.spyOptions = options
11
+ this.totalWaitTimeMs = 0
12
+ }
13
13
 
14
- public async wait(durationMs: number) {
15
- this.totalWaitTimeMs += durationMs
16
- return Promise.resolve()
17
- }
14
+ public async wait(durationMs: number) {
15
+ this.totalWaitTimeMs += durationMs
16
+ return Promise.resolve()
17
+ }
18
18
  }
@@ -1,38 +1,38 @@
1
1
  import { DurationMarker, TimeMarkerOutlet } from '../nodeLsl.types'
2
2
 
3
3
  export default class SpyImplementsTimeMarkerOutlet implements TimeMarkerOutlet {
4
- public pushMarkersCalls: DurationMarker[][]
5
- public pushSampleCalls: string[][]
6
- public numStopCalls: number
7
- public numDestroyCalls: number
4
+ public pushMarkersCalls: DurationMarker[][]
5
+ public pushSampleCalls: string[][]
6
+ public numStopCalls: number
7
+ public numDestroyCalls: number
8
8
 
9
- public constructor() {
10
- this.pushMarkersCalls = []
11
- this.pushSampleCalls = []
12
- this.numStopCalls = 0
13
- this.numDestroyCalls = 0
14
- }
9
+ public constructor() {
10
+ this.pushMarkersCalls = []
11
+ this.pushSampleCalls = []
12
+ this.numStopCalls = 0
13
+ this.numDestroyCalls = 0
14
+ }
15
15
 
16
- public async pushMarkers(markers: DurationMarker[]) {
17
- this.pushMarkersCalls.push(markers)
18
- }
16
+ public async pushMarkers(markers: DurationMarker[]) {
17
+ this.pushMarkersCalls.push(markers)
18
+ }
19
19
 
20
- public pushSample(sample: string[]) {
21
- this.pushSampleCalls.push(sample)
22
- }
20
+ public pushSample(sample: string[]) {
21
+ this.pushSampleCalls.push(sample)
22
+ }
23
23
 
24
- public stop() {
25
- this.numStopCalls++
26
- }
24
+ public stop() {
25
+ this.numStopCalls++
26
+ }
27
27
 
28
- public destroy() {
29
- this.numDestroyCalls++
30
- }
28
+ public destroy() {
29
+ this.numDestroyCalls++
30
+ }
31
31
 
32
- public resetSpy() {
33
- this.pushMarkersCalls = []
34
- this.pushSampleCalls = []
35
- this.numStopCalls = 0
36
- this.numDestroyCalls = 0
37
- }
32
+ public resetSpy() {
33
+ this.pushMarkersCalls = []
34
+ this.pushSampleCalls = []
35
+ this.numStopCalls = 0
36
+ this.numDestroyCalls = 0
37
+ }
38
38
  }
@@ -1,17 +1,17 @@
1
1
  export function isStringInArray(value: string, array: readonly string[]) {
2
- return array.indexOf(value) !== -1
2
+ return array.indexOf(value) !== -1
3
3
  }
4
4
 
5
5
  export function isGreaterThanOrEqualToZero(value: number) {
6
- return value >= 0
6
+ return value >= 0
7
7
  }
8
8
 
9
9
  export function isPositiveInteger(value: number) {
10
- //@ts-ignore
11
- return Number.isInteger(value) && value > 0
10
+ //@ts-ignore
11
+ return Number.isInteger(value) && value > 0
12
12
  }
13
13
 
14
14
  export function isPositiveIntegerOrZero(value: number) {
15
- //@ts-ignore
16
- return Number.isInteger(value) && value >= 0
15
+ //@ts-ignore
16
+ return Number.isInteger(value) && value >= 0
17
17
  }