deprecated.js 934 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.deprecationWarning = undefined;
  6. var _utils;
  7. function _load_utils() {
  8. return _utils = require('./utils');
  9. }
  10. /**
  11. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  12. *
  13. * This source code is licensed under the MIT license found in the
  14. * LICENSE file in the root directory of this source tree.
  15. *
  16. *
  17. */
  18. const deprecationMessage = (message, options) => {
  19. const comment = options.comment;
  20. const name = options.title && options.title.deprecation || (_utils || _load_utils()).DEPRECATION;
  21. (0, (_utils || _load_utils()).logValidationWarning)(name, message, comment);
  22. };
  23. const deprecationWarning = exports.deprecationWarning = (config, option, deprecatedOptions, options) => {
  24. if (option in deprecatedOptions) {
  25. deprecationMessage(deprecatedOptions[option](config), options);
  26. return true;
  27. }
  28. return false;
  29. };