@flexent/ pathmatcher (英语)
基于路径名的路径匹配 utils .
主要特点
- 零依赖关系
- 非常瘦——只有几百字节被咬
- 快速闪亮
- XQ 在浏览器中工作
- 🗜和紧凑
- Ergonomic (Ergonomic ) (二等)
- 强打字
- 非常严格的特性集
使用量
matchPath('/users/{name}', '/users/joe'); // { name: 'joe' }
matchPath('/users/{name}', '/users/', ); // null — no match
matchPath('/users', '/users'); // {} — match with no parameters
matchPath('/users/', '/users'); // {} — note: trailing slashes are ignored both ways
// Prefix mode — match only the beginning of the path
matchPath('/users', '/users/foo', true); // {} — match with no parameters