@canboat/canboatjs 2.5.0 → 2.5.1
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 +9 -4
- package/package.json +1 -1
package/lib/fromPgn.js
CHANGED
|
@@ -513,12 +513,16 @@ function getField(pgn, index, data) {
|
|
|
513
513
|
var pgnList = pgns[pgn]
|
|
514
514
|
if ( pgnList ) {
|
|
515
515
|
var pgn = pgnList[0]
|
|
516
|
+
let dataList = data.list ? data.list : data.fields.list
|
|
516
517
|
|
|
517
518
|
if ( pgnList.length > 1 ) {
|
|
518
|
-
|
|
519
|
+
let idx = 0
|
|
520
|
+
while ( idx < pgn.Fields.count )
|
|
521
|
+
{
|
|
522
|
+
field = pgn.Fields[idx]
|
|
519
523
|
var hasMatch = !_.isUndefined(field.Match)
|
|
520
|
-
if ( hasMatch &&
|
|
521
|
-
let param =
|
|
524
|
+
if ( hasMatch && dataList.length > 0 ) {
|
|
525
|
+
let param = dataList.find(f => f.Parameter === idx+1)
|
|
522
526
|
|
|
523
527
|
if ( param ) {
|
|
524
528
|
pgnList = pgnList.filter(f => f.Fields[idx].Match == param.Value)
|
|
@@ -530,7 +534,8 @@ function getField(pgn, index, data) {
|
|
|
530
534
|
}
|
|
531
535
|
}
|
|
532
536
|
}
|
|
533
|
-
|
|
537
|
+
idx++
|
|
538
|
+
}
|
|
534
539
|
}
|
|
535
540
|
|
|
536
541
|
if ( index >= 0 && index < pgn.Fields.length ) {
|