@refinedev/core
Version:
Refine is a React meta-framework for building enterprise-level, data-intensive applications rapidly with support for modern UI libraries and headless integrations.
22 lines (18 loc) • 536 B
text/typescript
import { useRefineContext } from "@hooks/refine";
/**
* A method that the internal uses
* @internal
*/
export const useUserFriendlyName = () => {
const {
options: { textTransformers },
} = useRefineContext();
const getFriendlyName = (name = "", type: "singular" | "plural"): string => {
const humanizeName = textTransformers.humanize(name);
if (type === "singular") {
return textTransformers.singular(humanizeName);
}
return textTransformers.plural(humanizeName);
};
return getFriendlyName;
};