@canboat/canboatjs 2.0.0-beta1 → 2.0.0-beta3
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/lib/fromPgn.js +13 -9
- package/package.json +3 -3
package/lib/fromPgn.js
CHANGED
|
@@ -742,17 +742,21 @@ function readVariableLengthField(options, pgn, field, bs) {
|
|
|
742
742
|
* length and thus that the field number is exactly one byte earlier.
|
|
743
743
|
*/
|
|
744
744
|
|
|
745
|
-
|
|
745
|
+
try {
|
|
746
|
+
var refField = getField(pgn.fields.PGN, bs.view.buffer[bs.byteIndex-1]-1, pgn)
|
|
746
747
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
748
|
+
if ( refField ) {
|
|
749
|
+
var bits = (refField.BitLength + 7) & ~7; // Round # of bits in field refField up to complete bytes: 1->8, 7->8, 8->8 etc.
|
|
750
|
+
let res = readField(options, false, pgn, refField, bs)
|
|
751
|
+
|
|
752
|
+
if ( bits > refField.BitLength ) {
|
|
753
|
+
bs.readBits(bits - refField.BitLength, false)
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return res
|
|
753
757
|
}
|
|
754
|
-
|
|
755
|
-
|
|
758
|
+
} catch ( error ) {
|
|
759
|
+
debug(error)
|
|
756
760
|
}
|
|
757
761
|
}
|
|
758
762
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canboat/canboatjs",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta3",
|
|
4
4
|
"description": "Native javascript version of canboat",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
],
|
|
54
54
|
"license": "Apache-2.0",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@canboat/pgns": "2.
|
|
56
|
+
"@canboat/pgns": "2.x.x",
|
|
57
57
|
"bit-buffer": "0.2.3",
|
|
58
58
|
"date-fns": "2.0.0-alpha.27",
|
|
59
59
|
"debug": "^4.3.4",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"optionalDependencies": {
|
|
82
82
|
"serialport": "^9.0.7",
|
|
83
|
-
"socketcan": "^
|
|
83
|
+
"socketcan": "^4.0.3"
|
|
84
84
|
},
|
|
85
85
|
"repository": {
|
|
86
86
|
"type": "git",
|