diff --git a/lib/fromPgn.js b/lib/fromPgn.js index 5fa522d..5ccd15a 100644 --- a/lib/fromPgn.js +++ b/lib/fromPgn.js @@ -611,6 +611,7 @@ function readField(options, runPostProcessor, pgn, field, bs, fields) { } if ( options.checkForInvalidFields !== false && max !== 'undefined' && field.FieldType !== 'LOOKUP' && + field.FieldType !== 'FIELDTYPE_LOOKUP' && field.BitLength > 1 && max - value <= 0 ) { //console.log(`Bad field ${field.Name} ${max - value}`) @@ -633,7 +634,8 @@ function readField(options, runPostProcessor, pgn, field, bs, fields) { value = Number.parseFloat(value.toFixed(precision)) } - if (field.FieldType === 'LOOKUP' && + if ((field.FieldType === 'LOOKUP' || + field.FieldType === 'FIELDTYPE_LOOKUP') && runPostProcessor && (_.isUndefined(options.resolveEnums) || options.resolveEnums)) { diff --git a/lib/toPgn.js b/lib/toPgn.js index 6335168..f5f0fc9 100644 --- a/lib/toPgn.js +++ b/lib/toPgn.js @@ -190,7 +190,8 @@ function writeField(bs, pgn_number, field, data, value, fields, bitLength) { } } else if ( type && fieldTypeMappers[type] ) { value = fieldTypeMappers[type](field, value) - } else if (field.FieldType === 'LOOKUP' && _.isString(value)) { + } else if ((field.FieldType === 'LOOKUP' || + field.FieldType === 'FIELDTYPE_LOOKUP') && _.isString(value)) { if (!(field.Id === "timeStamp" && value < 60)) { value = lookup(field, value) }