UNPKG

1.03 kBJavaScriptView Raw
1import { warn } from './warn';
2/**
3 * Warns when a deprecated props are being used.
4 *
5 * @public
6 * @param componentName - The name of the component being used.
7 * @param props - The props passed into the component.
8 * @param deprecationMap - The map of deprecations, where key is the prop name and the value is
9 * either null or a replacement prop name.
10 */
11export function warnDeprecations(componentName, props, deprecationMap) {
12 if (process.env.NODE_ENV !== 'production') {
13 for (var propName in deprecationMap) {
14 if (props && propName in props) {
15 var deprecationMessage = componentName + " property '" + propName + "' was used but has been deprecated.";
16 var replacementPropName = deprecationMap[propName];
17 if (replacementPropName) {
18 deprecationMessage += " Use '" + replacementPropName + "' instead.";
19 }
20 warn(deprecationMessage);
21 }
22 }
23 }
24}
25//# sourceMappingURL=warnDeprecations.js.map
\No newline at end of file