antd
Version:
An enterprise-class UI design language and React components implementation
12 lines • 334 B
JavaScript
/**
* Search for the first non-undefined value in the arguments and return it.
*
* ```js
* const mergedIcon = fallbackProp(propIcon, contextIcon, defaultIcon);
* ```
*
* Note: it is different from `??` operator which skips null
*/
export default function fallbackProp(...args) {
return args.find(arg => arg !== undefined);
}