src/modules/number.js
/**
* extracts a Javascript number from a BSON type.
*
* @param {Any} value     value to be converted to a number
* @return {Number}       converted value
*/
extracts a Javascript number from a BSON type.
extracts a Javascript number from a BSON type .
function extractNumericValueFromBSON(value) {
  if (has(value, '_bsontype')) {
    if (includes([ 'Decimal128', 'Long' ], value._bsontype)) {
      return parseFloat(value.toString(), 10);
    }
    if (includes([ 'Double', 'Int32' ], value._bsontype)) {
      return value.value;
    }
  }
  return value;
}
function extractNumericValueFromBSON ( value ) { if ( has ( value , '_bsontype' ) ) { if ( includes ( [ 'Decimal128' , 'Long' ] , value . _bsontype ) ) { return parseFloat ( value . toString ( ) , 10 ) ; } if ( includes ( [ 'Double' , 'Int32' ] , value . _bsontype ) ) { return value . value ; } } return value ; }
extracts a Javascript number from a BSON type.
extracts a Javascript number from a BSON type .
// unknown value, leave as is.