updeep-remeda/src/util/splitPath.ts

8 lines
247 B
TypeScript

export default function splitPath(path: string | number | (number | string)[]) {
if (typeof path === "number") path = new String(path) as any;
return Array.isArray(path)
? path
: (path as string).split(".").filter((x) => x !== "");
}