printPathArray.js.flow 282 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// @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('');
}