@canboat/canboatjs
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -63,2 +63,6 @@ /** | ||
if ( this.options.returnNulls === undefined ) { | ||
this.options.returnNulls = false | ||
} | ||
this.name = pkg.name | ||
@@ -239,3 +243,4 @@ this.version = pkg.version | ||
if ( !_.isUndefined(value) && value != null ) { | ||
if ( !_.isUndefined(value) && (value != null || | ||
this.options.returnNulls) ) { | ||
pgn.fields[field.Name] = value | ||
@@ -575,3 +580,14 @@ } | ||
} | ||
if ( field.Resolution && typeof value === 'number' ) { | ||
let max | ||
if ( typeof field.RangeMax !== 'undefined' | ||
&& field.Resolution ) { | ||
max = field.RangeMax / field.Resolution | ||
} | ||
if ( options.checkForInvalidFields !== false && max !== 'undefined' && | ||
field.FieldType !== 'LOOKUP' && | ||
field.BitLength > 1 && | ||
max - value <= 0 ) { | ||
//console.log(`Bad field ${field.Name} ${max - value}`) | ||
value = null | ||
} if ( field.Resolution && typeof value === 'number' ) { | ||
var resolution = field.Resolution | ||
@@ -592,9 +608,2 @@ | ||
value = Number.parseFloat(value.toFixed(precision)) | ||
if ( typeof field.RangeMin !== 'undefined' && value < field.RangeMin ) { | ||
value = null | ||
} | ||
if ( typeof field.RangeMax !== 'undefined' && value > field.RangeMax ) { | ||
value = null | ||
} | ||
} | ||
@@ -601,0 +610,0 @@ |
{ | ||
"name": "@canboat/canboatjs", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Native javascript version of canboat", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197465
4788