printPathArray.mjs 213 B

12345678910
  1. /**
  2. * Build a string describing the path.
  3. */
  4. export function printPathArray(path) {
  5. return path
  6. .map((key) =>
  7. typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key,
  8. )
  9. .join('');
  10. }