# @umijs/route-utils

> Quickly process the routing of umi

Latest version **4.0.3** (published 2025-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @umijs/route-utils
pnpm add @umijs/route-utils
yarn add @umijs/route-utils
bun add @umijs/route-utils
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2025-10-13 |
| First published | 2020-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 144.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Maintainers | sorrycc, chenshuai2144, kuitos, peachscript, xiaohuoni, yifankakaxi, xierenyuan, xusd320, zoomdong07 |

## Links

- npm: https://www.npmjs.com/package/@umijs/route-utils
- Repository: https://github.com/umijs/route-utils
- Homepage: https://github.com/umijs/route-utils#readme
- Issues: https://github.com/umijs/route-utils/issues
- npm.io page: https://npm.io/package/@umijs/route-utils

## Recent versions

- 4.0.3 (latest) — 2025-10-13
- 4.0.2 — 2025-10-12
- 4.0.1 — 2023-01-05
- 4.0.0 — 2023-01-05
- 2.2.2 — 2022-11-23
- 2.2.1 — 2022-10-20
- 3.0.0 — 2022-09-20
- 2.2.0 — 2022-08-03
- 2.1.5 — 2022-07-11
- 2.1.4 — 2022-07-04
- 2.1.3 — 2022-07-03
- 2.1.2 — 2022-07-03
- 2.1.1 — 2022-04-24
- 2.1.0 — 2022-04-23
- 2.0.5 — 2022-02-06
- … 42 more at https://npm.io/package/@umijs/route-utils/versions

## README

![](https://codecov.io/gh/umijs/route-utils/branch/master/graph/badge.svg) [![npm package](https://img.shields.io/npm/v/@umijs/route-utils.svg?style=flat-square?style=flat-square)](https://www.npmjs.com/package/@umijs/route-utils)

# @umijs/route-utils

## Usage

```bash
# npm
npm i @umijs/route-utils --save

## yarn
yarn add @umijs/route-utils
```

## API

```tsx
import { transformRoute, getMatchMenu } from '@umijs/route-utils';

const routes = [
  {
    path: '/welcome',
    name: 'welcome',
  },
  {
    path: '/admin',
    name: 'admin',
    access: 'canAdmin',
  },
  {
    name: 'list.table-list',
    path: '/list',
  },
];

const { menuData, breadcrumb } = transformRoute(routes);

console.log(menuData[0].name); // welcome

console.log(breadcrumb.get('/welcome').name); // welcome
```

### MenuDataItem

```tsx
import { MenuDataItem } from '@umijs/route-utils';

export interface MenuDataItem {
  routes?: MenuDataItem[];
  hideChildrenInMenu?: boolean;
  hideInMenu?: boolean;
  icon?: React.ReactNode;
  locale?: string | false;
  name?: string;
  key?: string;
  pro_layout_parentKeys?: string[];
  path?: string;
  [key: string]: any;
}
```

## LICENSE

MIT

---
_Source: https://npm.io/package/@umijs/route-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
