printPathArray.js.flow 283 B

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