01 · Before and afterThe pattern
One tokenizer for every dialect instead of string concatenation per driver.
// before (in several dialect files): const jsonPath = '$' + userPath;
export function toJsonPath(userPath: string): string {
return tokenize(userPath) // e.g. lodash toPath
.filter((part) => part !== '') // ".a..b." → ["a","b"]
.reduce((acc, part) => /^\d+$/.test(part) ? `${acc}[${part}]` : `${acc}.${part}`, '$');
}02 · Run it on your appThe check
If your app supports more than one database, does every dialect run the same input-normalisation code, with tests that run on each one?
If the honest answer is no or not sure, this is worth a look before it reaches production.