UNPKG

1.15 kBJavaScriptView Raw
1'use strict';
2
3exports.__esModule = true;
4exports.deprecated = deprecated;
5exports.warning = warning;
6
7var _env = require('./env');
8
9/* eslint no-console: 0 */
10
11/**
12 * 反对使用某一方法或属性的警告
13 * @param {String} props 过时的属性或方法名
14 * @param {String} instead 替代的属性或方法名
15 * @param {String} component 组件名
16 *
17 * @example
18 * log.deprecated('onBeforeClose', 'beforeClose', 'Dialog');
19 * // Warning: onBeforeClose is deprecated at [ Dialog ], use [ beforeClose ] instead of it.
20 */
21function deprecated(props, instead, component) {
22 /* istanbul ignore else */
23 if (!(0, _env.isProduction)() && typeof console !== 'undefined' && console.error) {
24 return console.error('Warning: [ ' + props + ' ] is deprecated at [ ' + component + ' ], ' + ('use [ ' + instead + ' ] instead of it.'));
25 }
26}
27
28/**
29 * 控制台警告日志
30 * @param {String} msg
31 * @return {Console<Error> | void}
32 */
33function warning(msg) {
34 /* istanbul ignore else */
35 if (!(0, _env.isProduction)() && typeof console !== 'undefined' && console.error) {
36 return console.error('Warning: ' + msg);
37 }
38}
\No newline at end of file