Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@umijs/route-utils

Package Overview
Dependencies
Maintainers
14
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umijs/route-utils - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

4

dist/getMatchMenu/getMatchMenu.d.ts

@@ -12,3 +12,5 @@ import { MenuDataItem } from '../types';

export declare const genKeysToArray: (menuKey: string) => string[];
export declare const getMenuMatches: (flatMenuKeys: string[] | undefined, path: string) => string | undefined;
export declare const getMenuMatches: (flatMenuKeys: string[] | undefined, path: string, flatMenus: {
[key: string]: MenuDataItem;
}) => string | undefined;
/**

@@ -15,0 +17,0 @@ * 获取当前的选中菜单列表

@@ -24,4 +24,8 @@ import pathToRegexp from 'path-to-regexp';

};
export const getMenuMatches = (flatMenuKeys = [], path) => flatMenuKeys
export const getMenuMatches = (flatMenuKeys = [], path, flatMenus) => flatMenuKeys
.filter(item => {
// 如果配置了 hideInMenu 就不需要选中了
if (flatMenus[item].hideInMenu) {
return false;
}
if (item === '/' && path === '/') {

@@ -62,3 +66,3 @@ return true;

const flatMenuKeys = Object.keys(flatMenus);
const menuPathKey = getMenuMatches(flatMenuKeys, pathname || '/');
const menuPathKey = getMenuMatches(flatMenuKeys, pathname || '/', flatMenus);
if (!menuPathKey) {

@@ -65,0 +69,0 @@ return [];

@@ -29,3 +29,9 @@ import pathToRegexp from 'path-to-regexp';

var path = arguments.length > 1 ? arguments[1] : undefined;
var flatMenus = arguments.length > 2 ? arguments[2] : undefined;
return flatMenuKeys.filter(function (item) {
// 如果配置了 hideInMenu 就不需要选中了
if (flatMenus[item].hideInMenu) {
return false;
}
if (item === '/' && path === '/') {

@@ -71,3 +77,3 @@ return true;

var flatMenuKeys = Object.keys(flatMenus);
var menuPathKey = getMenuMatches(flatMenuKeys, pathname || '/');
var menuPathKey = getMenuMatches(flatMenuKeys, pathname || '/', flatMenus);

@@ -74,0 +80,0 @@ if (!menuPathKey) {

@@ -42,3 +42,9 @@ "use strict";

var path = arguments.length > 1 ? arguments[1] : undefined;
var flatMenus = arguments.length > 2 ? arguments[2] : undefined;
return flatMenuKeys.filter(function (item) {
// 如果配置了 hideInMenu 就不需要选中了
if (flatMenus[item].hideInMenu) {
return false;
}
if (item === '/' && path === '/') {

@@ -87,3 +93,3 @@ return true;

var flatMenuKeys = Object.keys(flatMenus);
var menuPathKey = getMenuMatches(flatMenuKeys, pathname || '/');
var menuPathKey = getMenuMatches(flatMenuKeys, pathname || '/', flatMenus);

@@ -90,0 +96,0 @@ if (!menuPathKey) {

{
"name": "@umijs/route-utils",
"version": "1.0.16",
"version": "1.0.17",
"description": "Quickly process the routing of umi",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc