@fluentui/react-northstar
Version:
A themable React component library.
18 lines (17 loc) • 592 B
JavaScript
import _uniqueId from "lodash/uniqueId";
import _isPlainObject from "lodash/isPlainObject";
import _isNil from "lodash/isNil";
import * as React from 'react';
export var getOrGenerateIdFromShorthand = function getOrGenerateIdFromShorthand(prefix, value, currentValue) {
if (_isNil(value)) {
return undefined;
}
var result;
if ( /*#__PURE__*/React.isValidElement(value)) {
result = value.props.id;
} else if (_isPlainObject(value)) {
result = value.id;
}
return result || currentValue || _uniqueId(prefix);
};
//# sourceMappingURL=getOrGenerateIdFromShorthand.js.map