caed12b746a7a372e4eaa75fd0147e7d4c72931c
[aai/esr-gui.git] /
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
17 // BSON MAX VALUES
18 BSON.BSON_INT32_MAX = 0x7FFFFFFF;
19 BSON.BSON_INT32_MIN = -0x80000000;
20
21 BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;
22 BSON.BSON_INT64_MIN = -Math.pow(2, 63);
23
24 // JS MAX PRECISE VALUES
25 BSON.JS_INT_MAX = 0x20000000000000;  // Any integer up to 2^53 can be precisely represented by a double.
26 BSON.JS_INT_MIN = -0x20000000000000;  // Any integer down to -2^53 can be precisely represented by a double.
27
28 // Add BSON types to function creation
29 BSON.Binary = Binary;
30 BSON.Code = Code;
31 BSON.DBRef = DBRef;
32 BSON.Decimal128 = Decimal128;
33 BSON.Double = Double;
34 BSON.Int32 = Int32;
35 BSON.Long = Long;
36 BSON.Map = Map;
37 BSON.MaxKey = MaxKey;
38 BSON.MinKey = MinKey;
39 BSON.ObjectId = ObjectId;
40 BSON.ObjectID = ObjectId;
41 BSON.BSONRegExp = BSONRegExp;
42 BSON.Symbol = Symbol;
43 BSON.Timestamp = Timestamp;
44
45 // Return the BSON
46 module.exports = BSON;