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.

24 lines
727 B

4 years ago
  1. 'use strict';
  2. /*eslint no-console:0*/
  3. /**
  4. * Supply a warning to the developer that a method they are using
  5. * has been deprecated.
  6. *
  7. * @param {string} method The name of the deprecated method
  8. * @param {string} [instead] The alternate method to use if applicable
  9. * @param {string} [docs] The documentation URL to get further details
  10. */
  11. module.exports = function deprecatedMethod(method, instead, docs) {
  12. try {
  13. console.warn(
  14. 'DEPRECATED method `' + method + '`.' +
  15. (instead ? ' Use `' + instead + '` instead.' : '') +
  16. ' This method will be removed in a future release.');
  17. if (docs) {
  18. console.warn('For more information about usage see ' + docs);
  19. }
  20. } catch (e) { /* Ignore */ }
  21. };