index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. var BSON = require('./lib/bson/bson'),
  2. Binary = require('./lib/bson/binary'),
  3. Code = require('./lib/bson/code'),
  4. DBRef = require('./lib/bson/db_ref'),
  5. Decimal128 = require('./lib/bson/decimal128'),
  6. Double = require('./lib/bson/double'),
  7. Int32 = require('./lib/bson/int_32'),
  8. Long = require('./lib/bson/long'),
  9. Map = require('./lib/bson/map'),
  10. MaxKey = require('./lib/bson/max_key'),
  11. MinKey = require('./lib/bson/min_key'),
  12. ObjectId = require('./lib/bson/objectid'),
  13. BSONRegExp = require('./lib/bson/regexp'),
  14. Symbol = require('./lib/bson/symbol'),
  15. Timestamp = require('./lib/bson/timestamp');
  16. // BSON MAX VALUES
  17. BSON.BSON_INT32_MAX = 0x7fffffff;
  18. BSON.BSON_INT32_MIN = -0x80000000;
  19. BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;
  20. BSON.BSON_INT64_MIN = -Math.pow(2, 63);
  21. // JS MAX PRECISE VALUES
  22. BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.
  23. BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.
  24. // Add BSON types to function creation
  25. BSON.Binary = Binary;
  26. BSON.Code = Code;
  27. BSON.DBRef = DBRef;
  28. BSON.Decimal128 = Decimal128;
  29. BSON.Double = Double;
  30. BSON.Int32 = Int32;
  31. BSON.Long = Long;
  32. BSON.Map = Map;
  33. BSON.MaxKey = MaxKey;
  34. BSON.MinKey = MinKey;
  35. BSON.ObjectId = ObjectId;
  36. BSON.ObjectID = ObjectId;
  37. BSON.BSONRegExp = BSONRegExp;
  38. BSON.Symbol = Symbol;
  39. BSON.Timestamp = Timestamp;
  40. // Return the BSON
  41. module.exports = BSON;