---
title: "joinPath"
description: "将片段数组序列化为路径字符串"
seo_title: "joinPath"
seo_description: "Serialize an array of path segments into a single path string, the inverse of toPath for building dot and bracket accessors."
canonical_url: "https://core.mhaibaraai.cn/docs/helpers/path/join-path"
---
# joinPath

> 将片段数组序列化为路径字符串

## 用法

`joinPath` 函数用于将片段数组序列化为路径字符串。

```ts
import { joinPath } from '@movk/core'

const p = joinPath(['a', 'x.y', 0, 'space key'])
// p: "a['x.y'][0]['space key']"
// 与解析往返:toPath(p) => ['a', 'x.y', 0, 'space key']
```

## API

### `joinPath(segments)`

将片段数组序列化为路径字符串。

### 参数

**segments** (`[string | number]()`) *required*: 路径片段数组。

### 返回值

**返回值** (`string`): 路径字符串。

## Changelog

See commit history for [src/helpers/path/joinPath.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/helpers/path/joinPath.ts).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
