@canboat/canboatjs 2.5.2 → 2.5.4
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.
- package/.github/workflows/test.yml +28 -0
- package/lib/fromPgn.js +4 -4
- package/lib/stringMsg.js +0 -1
- package/lib/toPgn.js +10 -1
- package/package.json +1 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
+
|
|
4
|
+
name: Node.js CI & Test
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "master" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "master" ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
node-version: [16.x, 18.x, 20.x]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v3
|
|
23
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
24
|
+
uses: actions/setup-node@v3
|
|
25
|
+
with:
|
|
26
|
+
node-version: ${{ matrix.node-version }}
|
|
27
|
+
- run: npm install
|
|
28
|
+
- run: npm test
|
package/lib/fromPgn.js
CHANGED
|
@@ -24,7 +24,6 @@ const BitStream = require('bit-buffer').BitStream
|
|
|
24
24
|
const BitView = require('bit-buffer').BitView
|
|
25
25
|
const Int64LE = require('int64-buffer').Int64LE
|
|
26
26
|
const Uint64LE = require('int64-buffer').Uint64LE
|
|
27
|
-
const { parse: parseDate } = require('date-fns')
|
|
28
27
|
|
|
29
28
|
const { getPGNFromCanId } = require('./utilities')
|
|
30
29
|
const { getIndustryName, getManufacturerName } = require('./codes')
|
|
@@ -120,9 +119,7 @@ class Parser extends EventEmitter {
|
|
|
120
119
|
})
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
trace(`${pgn.pgn} ${len} ${pgnData.Length} ${RepeatingFields} ${couldBeMulti}`)
|
|
122
|
+
trace(`${pgn.pgn} ${len} ${pgnData.Length} ${couldBeMulti}`)
|
|
126
123
|
if ( coalesced || len > 0x8 || (this.format == FORMAT_COALESCED && !this.mixedFormat) ) {
|
|
127
124
|
this.format = FORMAT_COALESCED
|
|
128
125
|
if ( sourceString ) {
|
|
@@ -204,6 +201,8 @@ class Parser extends EventEmitter {
|
|
|
204
201
|
pgn.input = [ sourceString ]
|
|
205
202
|
}
|
|
206
203
|
|
|
204
|
+
let RepeatingFields = pgnData.RepeatingFieldSet1Size ? pgnData.RepeatingFieldSet1Size : 0
|
|
205
|
+
|
|
207
206
|
pgn.fields = {}
|
|
208
207
|
try {
|
|
209
208
|
var fields = pgnData.Fields
|
|
@@ -246,6 +245,7 @@ class Parser extends EventEmitter {
|
|
|
246
245
|
if ( value == null ) {
|
|
247
246
|
value = pgnData.Fields[i].Match
|
|
248
247
|
}
|
|
248
|
+
RepeatingFields = pgnData.RepeatingFieldSet1Size ? pgnData.RepeatingFieldSet1Size : 0
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
package/lib/stringMsg.js
CHANGED
package/lib/toPgn.js
CHANGED
|
@@ -34,9 +34,11 @@ const RES_STRINGLZ = 'STRING_LZ' //'ASCII string starting with length byte'
|
|
|
34
34
|
var fieldTypeWriters = {}
|
|
35
35
|
var fieldTypeMappers = {}
|
|
36
36
|
|
|
37
|
-
|
|
38
37
|
var lengthsOff = { 129029: 45, 127257:8, 127258:8, 127251:8 }
|
|
39
38
|
|
|
39
|
+
const a126208_oldKey = '# of Parameters'
|
|
40
|
+
const a126208_newKey = 'Number of Parameters'
|
|
41
|
+
|
|
40
42
|
function toPgn(data) {
|
|
41
43
|
const customPgns = getCustomPgn(data.pgn)
|
|
42
44
|
let pgnList = pgns[data.pgn]
|
|
@@ -71,6 +73,13 @@ function toPgn(data) {
|
|
|
71
73
|
data = data.fields
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
if ( pgn_number === 126208 && !data[a126208_newKey] && data[a126208_oldKey] ) {
|
|
77
|
+
//a bit of a hack because this field name changed and I'm sure there is code out
|
|
78
|
+
//there that still uses the old field name
|
|
79
|
+
|
|
80
|
+
data[a126208_newKey] = data[a126208_oldKey]
|
|
81
|
+
}
|
|
82
|
+
|
|
74
83
|
var fields = pgnData.Fields
|
|
75
84
|
if ( !_.isArray(fields) ) {
|
|
76
85
|
fields = [ fields.Field ]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canboat/canboatjs",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.4",
|
|
4
4
|
"description": "Native javascript version of canboat",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@canboat/pgns": "3.x.x",
|
|
59
59
|
"bit-buffer": "0.2.3",
|
|
60
|
-
"date-fns": "2.0.0-alpha.27",
|
|
61
60
|
"debug": "^4.3.4",
|
|
62
61
|
"dnssd": "^0.4.1",
|
|
63
62
|
"int64-buffer": "^0.1.10",
|