MCPcopy
hub / github.com/refinedev/refine / accessor

Function accessor

packages/inferencer/src/utilities/accessor/index.ts:44–57  ·  view source on GitHub ↗
(
  variable: string,
  key?: string,
  accessor?: string | string[],
  joiner: string | false = ' + " " + ',
)

Source from the content-addressed store, hash-verified

42 * @example accessor("myVar", "so-me", th.ing") === "myVar?.['so-me']['th.ing']"
43 */
44export const accessor = (
45 variable: string,
46 key?: string,
47 accessor?: string | string[],
48 joiner: string | false = ' + " " + ',
49): string => {
50 if (Array.isArray(accessor)) {
51 if (joiner) {
52 return accessorMultiple(variable, key, accessor).join(joiner);
53 }
54 return accessorSingle(variable, key, accessor[0]);
55 }
56 return accessorSingle(variable, key, accessor);
57};
58
59export const dotAccessor = (
60 variable: string,

Callers 15

renderRelationFieldsFunction · 0.90
basicInputFieldsFunction · 0.90
booleanFieldsFunction · 0.90
rendererFunction · 0.90
renderRelationFieldsFunction · 0.90
basicInputFieldsFunction · 0.90
booleanFieldsFunction · 0.90
rendererFunction · 0.90
renderRelationFieldsFunction · 0.90
textFieldsFunction · 0.90
imageFieldsFunction · 0.90
emailFieldsFunction · 0.90

Calls 2

accessorMultipleFunction · 0.85
accessorSingleFunction · 0.85

Tested by

no test coverage detected