summaryrefslogtreecommitdiff
path: root/school/node_modules/graphql/jsutils/printPathArray.js.flow
blob: 552a4156e30cd96c08379b40b1546598d71a34d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// @flow strict
/**
 * Build a string describing the path.
 */
export default function printPathArray(
  path: $ReadOnlyArray<string | number>,
): string {
  return path
    .map((key) =>
      typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key,
    )
    .join('');
}