UNPKG

hd-utils

Version:

A handy utils for modern JS developers

11 lines (10 loc) 290 B
/** * @description will convert passed path string into object path for navigation * @example stringToPath("a.b.c[0]") => ["a", "b", "c", "0"] */ export default function stringToPath(path) { return path .replace(/\[/g, '.') .replace(/\]/g, '') .split('.'); }