You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
565 B

  1. /*
  2. * node-rdkafka - Node.js wrapper for RdKafka C/C++ library
  3. *
  4. * Copyright (c) 2016 Blizzard Entertainment
  5. *
  6. * This software may be modified and distributed under the terms
  7. * of the MIT license. See the LICENSE.txt file for details.
  8. */
  9. var util = module.exports = {};
  10. util.shallowCopy = function (obj) {
  11. if (!util.isObject(obj)) { return obj; }
  12. var copy = {};
  13. for (var k in obj) {
  14. if (obj.hasOwnProperty(k)) {
  15. copy[k] = obj[k];
  16. }
  17. }
  18. return copy;
  19. };
  20. util.isObject = function (obj) {
  21. return obj && typeof obj === 'object';
  22. };