stream-chat-react
Version:
React components to create chat conversations or livestream style chat
13 lines (12 loc) • 560 B
JavaScript
export const deprecationAndReplacementWarning = (pairs, component) => {
pairs.forEach((data) => {
const [[oldName, oldValue], [newName, newValue]] = [
Object.entries(data[0])[0],
Object.entries(data[1])[0],
];
if ((typeof oldValue !== 'undefined' && typeof newValue === 'undefined') ||
(typeof oldValue !== 'undefined' && typeof newValue !== 'undefined')) {
console.warn(`[Deprecation notice (${component})]: prefer using prop ${newName} instead of ${oldName}`);
}
});
};