defaultValue-f2e68450.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['exports', './freezeObject-2d83f591'], function (exports, freezeObject) { 'use strict';
  3. /**
  4. * Returns the first parameter if not undefined, otherwise the second parameter.
  5. * Useful for setting a default value for a parameter.
  6. *
  7. * @exports defaultValue
  8. *
  9. * @param {*} a
  10. * @param {*} b
  11. * @returns {*} Returns the first parameter if not undefined, otherwise the second parameter.
  12. *
  13. * @example
  14. * param = Cesium.defaultValue(param, 'default');
  15. */
  16. function defaultValue(a, b) {
  17. if (a !== undefined && a !== null) {
  18. return a;
  19. }
  20. return b;
  21. }
  22. /**
  23. * A frozen empty object that can be used as the default value for options passed as
  24. * an object literal.
  25. * @type {Object}
  26. */
  27. defaultValue.EMPTY_OBJECT = freezeObject.freezeObject({});
  28. exports.defaultValue = defaultValue;
  29. });