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.
ant-design-vue/components/_util/warning.js

39 lines
831 B

5 years ago
/* eslint-disable no-console */
let warned = {};
7 years ago
5 years ago
export function warning(valid, message) {
// Support uglify
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
console.error(`Warning: ${message}`);
}
}
export function note(valid, message) {
// Support uglify
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
console.warn(`Note: ${message}`);
}
}
export function resetWarned() {
warned = {};
}
export function call(method, valid, message) {
7 years ago
if (!valid && !warned[message]) {
5 years ago
method(false, message);
warned[message] = true;
7 years ago
}
5 years ago
}
export function warningOnce(valid, message) {
call(warning, valid, message);
}
export function noteOnce(valid, message) {
call(note, valid, message);
}
export default warningOnce;
/* eslint-enable */