UNPKG

@refinedev/core

Version:

refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.

22 lines (18 loc) 536 B
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; };