From 0658fe0f90f4574e1c5360f25826f5b4b554d59a Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Mon, 19 Jun 2023 07:20:30 +0900 Subject: [PATCH] Add utils.ts --- denops/ddu/ddu.ts | 5 +---- denops/ddu/utils.ts | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 denops/ddu/utils.ts diff --git a/denops/ddu/ddu.ts b/denops/ddu/ddu.ts index 44efe24..8ea16f9 100644 --- a/denops/ddu/ddu.ts +++ b/denops/ddu/ddu.ts @@ -73,6 +73,7 @@ import { defaultColumnOptions } from "./base/column.ts"; import { defaultKindOptions } from "./base/kind.ts"; import { defaultActionOptions } from "./base/action.ts"; import { Loader } from "./loader.ts"; +import { treePath2Filename } from "./utils.ts"; type GatherState = { items: DduItem[]; @@ -2078,10 +2079,6 @@ function convertTreePath(treePath: TreePath) { return typeof treePath === "string" ? treePath.split(pathsep) : treePath; } -function treePath2Filename(treePath: TreePath) { - return typeof treePath === "string" ? treePath : treePath.join(pathsep); -} - function isParentPath(checkPath: string[], searchPath: string[]) { return checkPath !== searchPath && searchPath.join(pathsep).startsWith(checkPath.join(pathsep) + pathsep); diff --git a/denops/ddu/utils.ts b/denops/ddu/utils.ts new file mode 100644 index 0000000..78036a2 --- /dev/null +++ b/denops/ddu/utils.ts @@ -0,0 +1,6 @@ +import { pathsep } from "./deps.ts"; +import { TreePath } from "./types.ts"; + +export function treePath2Filename(treePath: TreePath) { + return typeof treePath === "string" ? treePath : treePath.join(pathsep); +}