Write a small JavaScript function route(grid) for a warehouse cart. The rectangular array of ASCII strings contains one 'S' start, one 'G' loading dock, '.' floor and '#' shelving. Return a string of U,D,L,R moves. Minimize steps first, then minimize direction changes among shortest paths. The first move is not a turn. Any tied optimal path is fine. If unreachable return null. Do not mutate grid. Maps are at most 12 by 12. Reply only with the function definition. No library, graphics, explanation or test code.