amis-rpc-design/node_modules/warn-once/index.js

19 lines
314 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
const DEV = process.env.NODE_ENV !== "production";
const warnings = new Set();
function warnOnce(condition, ...rest) {
if (DEV && condition) {
const key = rest.join(" ");
if (warnings.has(key)) {
return;
}
warnings.add(key);
console.warn(...rest);
}
}
module.exports = warnOnce;