@commercetools-docs/gatsby-theme-api-docs
Version:
Gatsby theme for commercetools documentation API
20 lines (17 loc) • 575 B
JavaScript
import { useTypeLocations } from './use-type-locations';
import generateTypesToRender from '../utils/generate-type-to-render';
/**
* It accepts either a single property or an array of properties.
* The function returns an array of types to render
*/
function useTypesToRender({ property, apiKey, isParameter } = {}) {
const typeLocations = useTypeLocations();
const properties = Array.isArray(property) ? property : [property];
return generateTypesToRender({
typeLocations,
properties,
apiKey,
isParameter,
});
}
export default useTypesToRender;