node-datachannel 0.3.1 → 0.3.2

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 (50) hide show
  1. package/.github/workflows/lint.yml +22 -0
  2. package/CMakeLists.txt +2 -2
  3. package/examples/client-server/client-benchmark.js +43 -32
  4. package/examples/client-server/client-periodic.js +30 -14
  5. package/examples/client-server/client.js +6 -5
  6. package/examples/client-server/package-lock.json +183 -44
  7. package/examples/client-server/signaling-server.js +3 -5
  8. package/examples/media/media.js +9 -9
  9. package/lib/index.d.ts +100 -100
  10. package/node_modules/lru-cache/package.json +2 -4
  11. package/node_modules/minimist/package.json +0 -1
  12. package/node_modules/node-abi/node_modules/semver/README.md +3 -1
  13. package/node_modules/node-abi/node_modules/semver/bin/semver.js +19 -9
  14. package/node_modules/node-abi/node_modules/semver/classes/comparator.js +3 -2
  15. package/node_modules/node-abi/node_modules/semver/classes/index.js +1 -1
  16. package/node_modules/node-abi/node_modules/semver/classes/range.js +31 -22
  17. package/node_modules/node-abi/node_modules/semver/classes/semver.js +1 -1
  18. package/node_modules/node-abi/node_modules/semver/functions/cmp.js +8 -4
  19. package/node_modules/node-abi/node_modules/semver/functions/coerce.js +3 -2
  20. package/node_modules/node-abi/node_modules/semver/functions/inc.js +4 -1
  21. package/node_modules/node-abi/node_modules/semver/functions/parse.js +1 -1
  22. package/node_modules/node-abi/node_modules/semver/internal/constants.js +2 -2
  23. package/node_modules/node-abi/node_modules/semver/internal/identifiers.js +1 -1
  24. package/node_modules/node-abi/node_modules/semver/internal/parse-options.js +3 -3
  25. package/node_modules/node-abi/node_modules/semver/internal/re.js +3 -3
  26. package/node_modules/node-abi/node_modules/semver/package.json +51 -18
  27. package/node_modules/node-abi/node_modules/semver/ranges/min-version.js +2 -1
  28. package/node_modules/node-abi/node_modules/semver/ranges/outside.js +1 -1
  29. package/node_modules/node-abi/node_modules/semver/ranges/simplify.js +15 -12
  30. package/node_modules/node-abi/node_modules/semver/ranges/subset.js +53 -31
  31. package/node_modules/npmlog/node_modules/are-we-there-yet/package.json +10 -10
  32. package/node_modules/npmlog/package.json +1 -1
  33. package/node_modules/tar-stream/node_modules/bl/.travis.yml +4 -3
  34. package/node_modules/tar-stream/node_modules/bl/BufferList.js +1 -1
  35. package/node_modules/tar-stream/node_modules/bl/package.json +10 -10
  36. package/node_modules/tar-stream/node_modules/bl/test/test.js +20 -2
  37. package/node_modules/wide-align/LICENSE +0 -0
  38. package/node_modules/wide-align/README.md +0 -0
  39. package/node_modules/wide-align/align.js +0 -0
  40. package/node_modules/wide-align/package.json +14 -14
  41. package/package.json +2 -2
  42. package/src/data-channel-wrapper.cpp +69 -53
  43. package/src/data-channel-wrapper.h +0 -1
  44. package/src/media-track-wrapper.cpp +91 -52
  45. package/src/media-track-wrapper.h +0 -1
  46. package/src/peer-connection-wrapper.cpp +106 -70
  47. package/src/peer-connection-wrapper.h +0 -2
  48. package/test/connectivity.js +18 -17
  49. package/test/test.js +22 -30
  50. package/node_modules/node-abi/node_modules/semver/CHANGELOG.md +0 -111
@@ -19,5 +19,5 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
19
19
 
20
20
  module.exports = {
21
21
  compareIdentifiers,
22
- rcompareIdentifiers
22
+ rcompareIdentifiers,
23
23
  }
@@ -4,8 +4,8 @@ const opts = ['includePrerelease', 'loose', 'rtl']
4
4
  const parseOptions = options =>
5
5
  !options ? {}
6
6
  : typeof options !== 'object' ? { loose: true }
7
- : opts.filter(k => options[k]).reduce((options, k) => {
8
- options[k] = true
9
- return options
7
+ : opts.filter(k => options[k]).reduce((o, k) => {
8
+ o[k] = true
9
+ return o
10
10
  }, {})
11
11
  module.exports = parseOptions
@@ -10,7 +10,7 @@ let R = 0
10
10
 
11
11
  const createToken = (name, value, isGlobal) => {
12
12
  const index = R++
13
- debug(index, value)
13
+ debug(name, index, value)
14
14
  t[name] = index
15
15
  src[index] = value
16
16
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
@@ -178,5 +178,5 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
178
178
  // Star ranges basically just allow anything at all.
179
179
  createToken('STAR', '(<|>)?=?\\s*\\*')
180
180
  // >=0.0.0 is like a star
181
- createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
182
- createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
181
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
182
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
@@ -1,32 +1,35 @@
1
1
  {
2
2
  "_args": [
3
3
  [
4
- "semver@7.3.5",
4
+ "semver@7.3.7",
5
5
  "/home/runner/work/node-datachannel/node-datachannel"
6
6
  ]
7
7
  ],
8
- "_from": "semver@7.3.5",
9
- "_id": "semver@7.3.5",
8
+ "_from": "semver@7.3.7",
9
+ "_id": "semver@7.3.7",
10
10
  "_inBundle": false,
11
- "_integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
11
+ "_integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
12
12
  "_location": "/node-abi/semver",
13
13
  "_phantomChildren": {},
14
14
  "_requested": {
15
15
  "type": "version",
16
16
  "registry": true,
17
- "raw": "semver@7.3.5",
17
+ "raw": "semver@7.3.7",
18
18
  "name": "semver",
19
19
  "escapedName": "semver",
20
- "rawSpec": "7.3.5",
20
+ "rawSpec": "7.3.7",
21
21
  "saveSpec": null,
22
- "fetchSpec": "7.3.5"
22
+ "fetchSpec": "7.3.7"
23
23
  },
24
24
  "_requiredBy": [
25
25
  "/node-abi"
26
26
  ],
27
- "_resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
28
- "_spec": "7.3.5",
27
+ "_resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
28
+ "_spec": "7.3.7",
29
29
  "_where": "/home/runner/work/node-datachannel/node-datachannel",
30
+ "author": {
31
+ "name": "GitHub Inc."
32
+ },
30
33
  "bin": {
31
34
  "semver": "bin/semver.js"
32
35
  },
@@ -38,20 +41,22 @@
38
41
  },
39
42
  "description": "The semantic version parser used by npm.",
40
43
  "devDependencies": {
41
- "tap": "^14.10.7"
44
+ "@npmcli/eslint-config": "^3.0.1",
45
+ "@npmcli/template-oss": "3.3.2",
46
+ "tap": "^16.0.0"
42
47
  },
43
48
  "engines": {
44
49
  "node": ">=10"
45
50
  },
46
51
  "files": [
47
- "bin/**/*.js",
48
- "range.bnf",
49
- "classes/**/*.js",
50
- "functions/**/*.js",
51
- "internal/**/*.js",
52
- "ranges/**/*.js",
52
+ "bin/",
53
+ "classes/",
54
+ "functions/",
55
+ "internal/",
56
+ "ranges/",
53
57
  "index.js",
54
- "preload.js"
58
+ "preload.js",
59
+ "range.bnf"
55
60
  ],
56
61
  "homepage": "https://github.com/npm/node-semver#readme",
57
62
  "license": "ISC",
@@ -62,15 +67,43 @@
62
67
  "url": "git+https://github.com/npm/node-semver.git"
63
68
  },
64
69
  "scripts": {
70
+ "lint": "eslint \"**/*.js\"",
71
+ "lintfix": "npm run lint -- --fix",
72
+ "postlint": "template-oss-check",
65
73
  "postpublish": "git push origin --follow-tags",
74
+ "posttest": "npm run lint",
66
75
  "postversion": "npm publish",
76
+ "prepublishOnly": "git push origin --follow-tags",
67
77
  "preversion": "npm test",
68
78
  "snap": "tap",
79
+ "template-oss-apply": "template-oss-apply --force",
69
80
  "test": "tap"
70
81
  },
71
82
  "tap": {
72
83
  "check-coverage": true,
73
84
  "coverage-map": "map.js"
74
85
  },
75
- "version": "7.3.5"
86
+ "templateOSS": {
87
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
88
+ "version": "3.3.2",
89
+ "engines": ">=10",
90
+ "ciVersions": [
91
+ "10.0.0",
92
+ "10.x",
93
+ "12.x",
94
+ "14.x",
95
+ "16.x"
96
+ ],
97
+ "distPaths": [
98
+ "bin/",
99
+ "classes/",
100
+ "functions/",
101
+ "internal/",
102
+ "ranges/",
103
+ "index.js",
104
+ "preload.js",
105
+ "range.bnf"
106
+ ]
107
+ },
108
+ "version": "7.3.7"
76
109
  }
@@ -47,8 +47,9 @@ const minVersion = (range, loose) => {
47
47
  throw new Error(`Unexpected operation: ${comparator.operator}`)
48
48
  }
49
49
  })
50
- if (setMin && (!minver || gt(minver, setMin)))
50
+ if (setMin && (!minver || gt(minver, setMin))) {
51
51
  minver = setMin
52
+ }
52
53
  }
53
54
 
54
55
  if (minver && range.test(minver)) {
@@ -1,6 +1,6 @@
1
1
  const SemVer = require('../classes/semver')
2
2
  const Comparator = require('../classes/comparator')
3
- const {ANY} = Comparator
3
+ const { ANY } = Comparator
4
4
  const Range = require('../classes/range')
5
5
  const satisfies = require('../functions/satisfies')
6
6
  const gt = require('../functions/gt')
@@ -5,38 +5,41 @@ const satisfies = require('../functions/satisfies.js')
5
5
  const compare = require('../functions/compare.js')
6
6
  module.exports = (versions, range, options) => {
7
7
  const set = []
8
- let min = null
8
+ let first = null
9
9
  let prev = null
10
10
  const v = versions.sort((a, b) => compare(a, b, options))
11
11
  for (const version of v) {
12
12
  const included = satisfies(version, range, options)
13
13
  if (included) {
14
14
  prev = version
15
- if (!min)
16
- min = version
15
+ if (!first) {
16
+ first = version
17
+ }
17
18
  } else {
18
19
  if (prev) {
19
- set.push([min, prev])
20
+ set.push([first, prev])
20
21
  }
21
22
  prev = null
22
- min = null
23
+ first = null
23
24
  }
24
25
  }
25
- if (min)
26
- set.push([min, null])
26
+ if (first) {
27
+ set.push([first, null])
28
+ }
27
29
 
28
30
  const ranges = []
29
31
  for (const [min, max] of set) {
30
- if (min === max)
32
+ if (min === max) {
31
33
  ranges.push(min)
32
- else if (!max && min === v[0])
34
+ } else if (!max && min === v[0]) {
33
35
  ranges.push('*')
34
- else if (!max)
36
+ } else if (!max) {
35
37
  ranges.push(`>=${min}`)
36
- else if (min === v[0])
38
+ } else if (min === v[0]) {
37
39
  ranges.push(`<=${max}`)
38
- else
40
+ } else {
39
41
  ranges.push(`${min} - ${max}`)
42
+ }
40
43
  }
41
44
  const simplified = ranges.join(' || ')
42
45
  const original = typeof range.raw === 'string' ? range.raw : String(range)
@@ -41,8 +41,9 @@ const compare = require('../functions/compare.js')
41
41
  // - Else return true
42
42
 
43
43
  const subset = (sub, dom, options = {}) => {
44
- if (sub === dom)
44
+ if (sub === dom) {
45
45
  return true
46
+ }
46
47
 
47
48
  sub = new Range(sub, options)
48
49
  dom = new Range(dom, options)
@@ -52,73 +53,84 @@ const subset = (sub, dom, options = {}) => {
52
53
  for (const simpleDom of dom.set) {
53
54
  const isSub = simpleSubset(simpleSub, simpleDom, options)
54
55
  sawNonNull = sawNonNull || isSub !== null
55
- if (isSub)
56
+ if (isSub) {
56
57
  continue OUTER
58
+ }
57
59
  }
58
60
  // the null set is a subset of everything, but null simple ranges in
59
61
  // a complex range should be ignored. so if we saw a non-null range,
60
62
  // then we know this isn't a subset, but if EVERY simple range was null,
61
63
  // then it is a subset.
62
- if (sawNonNull)
64
+ if (sawNonNull) {
63
65
  return false
66
+ }
64
67
  }
65
68
  return true
66
69
  }
67
70
 
68
71
  const simpleSubset = (sub, dom, options) => {
69
- if (sub === dom)
72
+ if (sub === dom) {
70
73
  return true
74
+ }
71
75
 
72
76
  if (sub.length === 1 && sub[0].semver === ANY) {
73
- if (dom.length === 1 && dom[0].semver === ANY)
77
+ if (dom.length === 1 && dom[0].semver === ANY) {
74
78
  return true
75
- else if (options.includePrerelease)
76
- sub = [ new Comparator('>=0.0.0-0') ]
77
- else
78
- sub = [ new Comparator('>=0.0.0') ]
79
+ } else if (options.includePrerelease) {
80
+ sub = [new Comparator('>=0.0.0-0')]
81
+ } else {
82
+ sub = [new Comparator('>=0.0.0')]
83
+ }
79
84
  }
80
85
 
81
86
  if (dom.length === 1 && dom[0].semver === ANY) {
82
- if (options.includePrerelease)
87
+ if (options.includePrerelease) {
83
88
  return true
84
- else
85
- dom = [ new Comparator('>=0.0.0') ]
89
+ } else {
90
+ dom = [new Comparator('>=0.0.0')]
91
+ }
86
92
  }
87
93
 
88
94
  const eqSet = new Set()
89
95
  let gt, lt
90
96
  for (const c of sub) {
91
- if (c.operator === '>' || c.operator === '>=')
97
+ if (c.operator === '>' || c.operator === '>=') {
92
98
  gt = higherGT(gt, c, options)
93
- else if (c.operator === '<' || c.operator === '<=')
99
+ } else if (c.operator === '<' || c.operator === '<=') {
94
100
  lt = lowerLT(lt, c, options)
95
- else
101
+ } else {
96
102
  eqSet.add(c.semver)
103
+ }
97
104
  }
98
105
 
99
- if (eqSet.size > 1)
106
+ if (eqSet.size > 1) {
100
107
  return null
108
+ }
101
109
 
102
110
  let gtltComp
103
111
  if (gt && lt) {
104
112
  gtltComp = compare(gt.semver, lt.semver, options)
105
- if (gtltComp > 0)
113
+ if (gtltComp > 0) {
106
114
  return null
107
- else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
115
+ } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
108
116
  return null
117
+ }
109
118
  }
110
119
 
111
120
  // will iterate one or zero times
112
121
  for (const eq of eqSet) {
113
- if (gt && !satisfies(eq, String(gt), options))
122
+ if (gt && !satisfies(eq, String(gt), options)) {
114
123
  return null
124
+ }
115
125
 
116
- if (lt && !satisfies(eq, String(lt), options))
126
+ if (lt && !satisfies(eq, String(lt), options)) {
117
127
  return null
128
+ }
118
129
 
119
130
  for (const c of dom) {
120
- if (!satisfies(eq, String(c), options))
131
+ if (!satisfies(eq, String(c), options)) {
121
132
  return false
133
+ }
122
134
  }
123
135
 
124
136
  return true
@@ -154,10 +166,12 @@ const simpleSubset = (sub, dom, options) => {
154
166
  }
155
167
  if (c.operator === '>' || c.operator === '>=') {
156
168
  higher = higherGT(gt, c, options)
157
- if (higher === c && higher !== gt)
169
+ if (higher === c && higher !== gt) {
158
170
  return false
159
- } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
171
+ }
172
+ } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
160
173
  return false
174
+ }
161
175
  }
162
176
  if (lt) {
163
177
  if (needDomLTPre) {
@@ -170,37 +184,44 @@ const simpleSubset = (sub, dom, options) => {
170
184
  }
171
185
  if (c.operator === '<' || c.operator === '<=') {
172
186
  lower = lowerLT(lt, c, options)
173
- if (lower === c && lower !== lt)
187
+ if (lower === c && lower !== lt) {
174
188
  return false
175
- } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
189
+ }
190
+ } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
176
191
  return false
192
+ }
177
193
  }
178
- if (!c.operator && (lt || gt) && gtltComp !== 0)
194
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
179
195
  return false
196
+ }
180
197
  }
181
198
 
182
199
  // if there was a < or >, and nothing in the dom, then must be false
183
200
  // UNLESS it was limited by another range in the other direction.
184
201
  // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
185
- if (gt && hasDomLT && !lt && gtltComp !== 0)
202
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
186
203
  return false
204
+ }
187
205
 
188
- if (lt && hasDomGT && !gt && gtltComp !== 0)
206
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
189
207
  return false
208
+ }
190
209
 
191
210
  // we needed a prerelease range in a specific tuple, but didn't get one
192
211
  // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
193
212
  // because it includes prereleases in the 1.2.3 tuple
194
- if (needDomGTPre || needDomLTPre)
213
+ if (needDomGTPre || needDomLTPre) {
195
214
  return false
215
+ }
196
216
 
197
217
  return true
198
218
  }
199
219
 
200
220
  // >=1.2.3 is lower than >1.2.3
201
221
  const higherGT = (a, b, options) => {
202
- if (!a)
222
+ if (!a) {
203
223
  return b
224
+ }
204
225
  const comp = compare(a.semver, b.semver, options)
205
226
  return comp > 0 ? a
206
227
  : comp < 0 ? b
@@ -210,8 +231,9 @@ const higherGT = (a, b, options) => {
210
231
 
211
232
  // <=1.2.3 is higher than <1.2.3
212
233
  const lowerLT = (a, b, options) => {
213
- if (!a)
234
+ if (!a) {
214
235
  return b
236
+ }
215
237
  const comp = compare(a.semver, b.semver, options)
216
238
  return comp < 0 ? a
217
239
  : comp > 0 ? b
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "_args": [
3
3
  [
4
- "are-we-there-yet@1.1.5",
4
+ "are-we-there-yet@1.1.7",
5
5
  "/home/runner/work/node-datachannel/node-datachannel"
6
6
  ]
7
7
  ],
8
- "_from": "are-we-there-yet@1.1.5",
9
- "_id": "are-we-there-yet@1.1.5",
8
+ "_from": "are-we-there-yet@1.1.7",
9
+ "_id": "are-we-there-yet@1.1.7",
10
10
  "_inBundle": false,
11
- "_integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
11
+ "_integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==",
12
12
  "_location": "/npmlog/are-we-there-yet",
13
13
  "_phantomChildren": {},
14
14
  "_requested": {
15
15
  "type": "version",
16
16
  "registry": true,
17
- "raw": "are-we-there-yet@1.1.5",
17
+ "raw": "are-we-there-yet@1.1.7",
18
18
  "name": "are-we-there-yet",
19
19
  "escapedName": "are-we-there-yet",
20
- "rawSpec": "1.1.5",
20
+ "rawSpec": "1.1.7",
21
21
  "saveSpec": null,
22
- "fetchSpec": "1.1.5"
22
+ "fetchSpec": "1.1.7"
23
23
  },
24
24
  "_requiredBy": [
25
25
  "/npmlog"
26
26
  ],
27
- "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
28
- "_spec": "1.1.5",
27
+ "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz",
28
+ "_spec": "1.1.7",
29
29
  "_where": "/home/runner/work/node-datachannel/node-datachannel",
30
30
  "author": {
31
31
  "name": "Rebecca Turner",
@@ -62,5 +62,5 @@
62
62
  "scripts": {
63
63
  "test": "standard && tap test/*.js"
64
64
  },
65
- "version": "1.1.5"
65
+ "version": "1.1.7"
66
66
  }
@@ -20,7 +20,7 @@
20
20
  "signal-exit": "3.0.3",
21
21
  "string-width": "1.0.2",
22
22
  "strip-ansi": "3.0.1",
23
- "wide-align": "1.1.3"
23
+ "wide-align": "1.1.5"
24
24
  },
25
25
  "_requested": {
26
26
  "type": "version",
@@ -1,4 +1,7 @@
1
1
  sudo: false
2
+ arch:
3
+ - amd64
4
+ - ppc64le
2
5
  language: node_js
3
6
  node_js:
4
7
  - '6'
@@ -6,10 +9,8 @@ node_js:
6
9
  - '10'
7
10
  - '12'
8
11
  - '14'
12
+ - '15'
9
13
  - lts/*
10
- branches:
11
- only:
12
- - master
13
14
  notifications:
14
15
  email:
15
16
  - rod@vagg.org
@@ -373,7 +373,7 @@ BufferList.prototype._match = function (offset, search) {
373
373
  return this.slice(offset, offset + byteLength)[m](0, byteLength)
374
374
  }
375
375
  } else {
376
- BufferList.prototype[m] = function (offset) {
376
+ BufferList.prototype[m] = function (offset = 0) {
377
377
  return this.slice(offset, offset + methods[m])[m](0)
378
378
  }
379
379
  }
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "_args": [
3
3
  [
4
- "bl@4.0.3",
4
+ "bl@4.1.0",
5
5
  "/home/runner/work/node-datachannel/node-datachannel"
6
6
  ]
7
7
  ],
8
- "_from": "bl@4.0.3",
9
- "_id": "bl@4.0.3",
8
+ "_from": "bl@4.1.0",
9
+ "_id": "bl@4.1.0",
10
10
  "_inBundle": false,
11
- "_integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==",
11
+ "_integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
12
12
  "_location": "/tar-stream/bl",
13
13
  "_phantomChildren": {},
14
14
  "_requested": {
15
15
  "type": "version",
16
16
  "registry": true,
17
- "raw": "bl@4.0.3",
17
+ "raw": "bl@4.1.0",
18
18
  "name": "bl",
19
19
  "escapedName": "bl",
20
- "rawSpec": "4.0.3",
20
+ "rawSpec": "4.1.0",
21
21
  "saveSpec": null,
22
- "fetchSpec": "4.0.3"
22
+ "fetchSpec": "4.1.0"
23
23
  },
24
24
  "_requiredBy": [
25
25
  "/tar-stream"
26
26
  ],
27
- "_resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz",
28
- "_spec": "4.0.3",
27
+ "_resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
28
+ "_spec": "4.1.0",
29
29
  "_where": "/home/runner/work/node-datachannel/node-datachannel",
30
30
  "authors": [
31
31
  "Rod Vagg <rod@vagg.org> (https://github.com/rvagg)",
@@ -64,5 +64,5 @@
64
64
  "lint": "standard *.js test/*.js",
65
65
  "test": "npm run lint && node test/test.js | faucet"
66
66
  },
67
- "version": "4.0.3"
67
+ "version": "4.1.0"
68
68
  }
@@ -265,6 +265,7 @@ tape('test readUInt8 / readInt8', function (t) {
265
265
  const buf3 = Buffer.alloc(3)
266
266
  const bl = new BufferList()
267
267
 
268
+ buf1[0] = 0x1
268
269
  buf2[1] = 0x3
269
270
  buf2[2] = 0x4
270
271
  buf3[0] = 0x23
@@ -274,6 +275,7 @@ tape('test readUInt8 / readInt8', function (t) {
274
275
  bl.append(buf2)
275
276
  bl.append(buf3)
276
277
 
278
+ t.equal(bl.readUInt8(), 0x1)
277
279
  t.equal(bl.readUInt8(2), 0x3)
278
280
  t.equal(bl.readInt8(2), 0x3)
279
281
  t.equal(bl.readUInt8(3), 0x4)
@@ -292,6 +294,7 @@ tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t
292
294
  const buf3 = Buffer.alloc(3)
293
295
  const bl = new BufferList()
294
296
 
297
+ buf1[0] = 0x1
295
298
  buf2[1] = 0x3
296
299
  buf2[2] = 0x4
297
300
  buf3[0] = 0x23
@@ -301,6 +304,8 @@ tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t
301
304
  bl.append(buf2)
302
305
  bl.append(buf3)
303
306
 
307
+ t.equal(bl.readUInt16BE(), 0x0100)
308
+ t.equal(bl.readUInt16LE(), 0x0001)
304
309
  t.equal(bl.readUInt16BE(2), 0x0304)
305
310
  t.equal(bl.readUInt16LE(2), 0x0403)
306
311
  t.equal(bl.readInt16BE(2), 0x0304)
@@ -323,6 +328,7 @@ tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t
323
328
  const buf3 = Buffer.alloc(3)
324
329
  const bl = new BufferList()
325
330
 
331
+ buf1[0] = 0x1
326
332
  buf2[1] = 0x3
327
333
  buf2[2] = 0x4
328
334
  buf3[0] = 0x23
@@ -332,6 +338,8 @@ tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t
332
338
  bl.append(buf2)
333
339
  bl.append(buf3)
334
340
 
341
+ t.equal(bl.readUInt32BE(), 0x01000304)
342
+ t.equal(bl.readUInt32LE(), 0x04030001)
335
343
  t.equal(bl.readUInt32BE(2), 0x03042342)
336
344
  t.equal(bl.readUInt32LE(2), 0x42230403)
337
345
  t.equal(bl.readInt32BE(2), 0x03042342)
@@ -391,6 +399,7 @@ tape('test readFloatLE / readFloatBE', function (t) {
391
399
  const buf3 = Buffer.alloc(3)
392
400
  const bl = new BufferList()
393
401
 
402
+ buf1[0] = 0x01
394
403
  buf2[1] = 0x00
395
404
  buf2[2] = 0x00
396
405
  buf3[0] = 0x80
@@ -400,7 +409,11 @@ tape('test readFloatLE / readFloatBE', function (t) {
400
409
  bl.append(buf2)
401
410
  bl.append(buf3)
402
411
 
403
- t.equal(bl.readFloatLE(2), 0x01)
412
+ const canonical = Buffer.concat([buf1, buf2, buf3])
413
+ t.equal(bl.readFloatLE(), canonical.readFloatLE())
414
+ t.equal(bl.readFloatBE(), canonical.readFloatBE())
415
+ t.equal(bl.readFloatLE(2), canonical.readFloatLE(2))
416
+ t.equal(bl.readFloatBE(2), canonical.readFloatBE(2))
404
417
 
405
418
  t.end()
406
419
  })
@@ -411,6 +424,7 @@ tape('test readDoubleLE / readDoubleBE', function (t) {
411
424
  const buf3 = Buffer.alloc(10)
412
425
  const bl = new BufferList()
413
426
 
427
+ buf1[0] = 0x01
414
428
  buf2[1] = 0x55
415
429
  buf2[2] = 0x55
416
430
  buf3[0] = 0x55
@@ -424,7 +438,11 @@ tape('test readDoubleLE / readDoubleBE', function (t) {
424
438
  bl.append(buf2)
425
439
  bl.append(buf3)
426
440
 
427
- t.equal(bl.readDoubleLE(2), 0.3333333333333333)
441
+ const canonical = Buffer.concat([buf1, buf2, buf3])
442
+ t.equal(bl.readDoubleBE(), canonical.readDoubleBE())
443
+ t.equal(bl.readDoubleLE(), canonical.readDoubleLE())
444
+ t.equal(bl.readDoubleBE(2), canonical.readDoubleBE(2))
445
+ t.equal(bl.readDoubleLE(2), canonical.readDoubleLE(2))
428
446
 
429
447
  t.end()
430
448
  })
File without changes
File without changes
File without changes