/node_modules/mongodb/node_modules/bson/lib/bson/index.js

https://bitbucket.org/gagginaspinnata/todo-app-with-angularjs · JavaScript · 74 lines · 64 code · 3 blank · 7 comment · 3 complexity · 6dd9fb285d9fdfe2543fc6654c2d0a91 MD5 · raw file

  1. try {
  2. exports.BSONPure = require('./bson');
  3. exports.BSONNative = require('../../ext');
  4. } catch(err) {
  5. // do nothing
  6. }
  7. [ './binary_parser'
  8. , './binary'
  9. , './code'
  10. , './db_ref'
  11. , './double'
  12. , './max_key'
  13. , './min_key'
  14. , './objectid'
  15. , './symbol'
  16. , './timestamp'
  17. , './long'].forEach(function (path) {
  18. var module = require('./' + path);
  19. for (var i in module) {
  20. exports[i] = module[i];
  21. }
  22. });
  23. // Exports all the classes for the NATIVE JS BSON Parser
  24. exports.native = function() {
  25. var classes = {};
  26. // Map all the classes
  27. [ './binary_parser'
  28. , './binary'
  29. , './code'
  30. , './db_ref'
  31. , './double'
  32. , './max_key'
  33. , './min_key'
  34. , './objectid'
  35. , './symbol'
  36. , './timestamp'
  37. , './long'
  38. , '../../ext'
  39. ].forEach(function (path) {
  40. var module = require('./' + path);
  41. for (var i in module) {
  42. classes[i] = module[i];
  43. }
  44. });
  45. // Return classes list
  46. return classes;
  47. }
  48. // Exports all the classes for the PURE JS BSON Parser
  49. exports.pure = function() {
  50. var classes = {};
  51. // Map all the classes
  52. [ './binary_parser'
  53. , './binary'
  54. , './code'
  55. , './db_ref'
  56. , './double'
  57. , './max_key'
  58. , './min_key'
  59. , './objectid'
  60. , './symbol'
  61. , './timestamp'
  62. , './long'
  63. , '././bson'].forEach(function (path) {
  64. var module = require('./' + path);
  65. for (var i in module) {
  66. classes[i] = module[i];
  67. }
  68. });
  69. // Return classes list
  70. return classes;
  71. }