提交学习笔记专用
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.

18 lines
422 B

  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports.deprecate = (fn, msg) => {
  7. let once = true;
  8. return function deprecate() {
  9. if (once) {
  10. // eslint-disable-next-line no-console
  11. console.warn(`DeprecationWarning: ${msg}`);
  12. once = false;
  13. }
  14. // eslint-disable-next-line prefer-rest-params
  15. return fn.apply(this, arguments);
  16. };
  17. };