@umijs/route-utils
Advanced tools
Comparing version 1.0.22 to 1.0.23
@@ -0,0 +0,0 @@ import { MenuDataItem } from '../types'; |
@@ -0,0 +0,0 @@ /** |
export {}; |
@@ -0,0 +0,0 @@ import getFlatMenus from './getFlatMenus'; |
@@ -0,0 +0,0 @@ import { MenuDataItem } from '../types'; |
@@ -0,0 +0,0 @@ import { pathToRegexp } from '@qixian.cs/path-to-regexp'; |
export {}; |
@@ -0,0 +0,0 @@ import getMatchMenu from './getMatchMenu'; |
@@ -0,0 +0,0 @@ declare const _default: ({ |
@@ -0,0 +0,0 @@ export default [ |
@@ -0,0 +0,0 @@ import { MenuDataItem } from './types'; |
@@ -0,0 +0,0 @@ export { default as transformRoute } from './transformRoute/transformRoute'; |
@@ -0,0 +0,0 @@ import { MenuDataItem, Route, MessageDescriptor } from '../types'; |
@@ -12,3 +12,3 @@ import isEqual from 'lodash.isequal'; | ||
export function guid() { | ||
return 'xxxxxxxx'.replace(/[xy]/g, (c) => { | ||
return 'xxxxxxxx'.replace(/[xy]/g, c => { | ||
// eslint-disable-next-line no-bitwise | ||
@@ -28,3 +28,6 @@ const r = (Math.random() * 16) | 0; | ||
try { | ||
return `/${hash.sha256().update(JSON.stringify(item)).digest('hex')}`; | ||
return `/${hash | ||
.sha256() | ||
.update(JSON.stringify(item)) | ||
.digest('hex')}`; | ||
} | ||
@@ -123,3 +126,3 @@ catch (error) { | ||
return data | ||
.filter((item) => { | ||
.filter(item => { | ||
if (!item) | ||
@@ -138,3 +141,3 @@ return false; | ||
}) | ||
.filter((item) => { | ||
.filter(item => { | ||
// 是否没有权限查看 | ||
@@ -164,3 +167,3 @@ if (item.unaccessible) { | ||
// close menu international | ||
const localeName = locale !== false && menuLocale !== false && formatMessage | ||
const localeName = locale !== false && menuLocale !== false && formatMessage && locale | ||
? formatMessage({ id: locale, defaultMessage: name }) | ||
@@ -181,3 +184,3 @@ : name; | ||
`/${parent.key || ''}`.replace(/\/\//g, '/').replace(/\/\//g, '/'), | ||
].filter((key) => key && key !== '/'), | ||
].filter(key => key && key !== '/'), | ||
}; | ||
@@ -229,3 +232,3 @@ if (localeName) { | ||
}) | ||
.filter((item) => item); | ||
.filter(item => item); | ||
/** | ||
@@ -256,3 +259,3 @@ * support pathToRegexp get string | ||
const flattenMenuData = (data, parent) => { | ||
data.forEach((menuItem) => { | ||
data.forEach(menuItem => { | ||
if (!menuItem) { | ||
@@ -287,3 +290,3 @@ return; | ||
}) | ||
.filter((item) => item); | ||
.filter(item => item); | ||
}; | ||
@@ -290,0 +293,0 @@ /** |
export {}; |
@@ -0,0 +0,0 @@ import transformRoute from './transformRoute'; |
@@ -0,0 +0,0 @@ export interface Route extends MenuDataItem { |
@@ -11,3 +11,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
@@ -22,3 +22,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
@@ -97,4 +97,4 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
return "/".concat(hash.sha256().update(JSON.stringify(item)).digest('hex')); | ||
} catch (error) {// dom some thing | ||
} // 要是还是不行,返回一个随机值 | ||
} catch (error) {} // dom some thing | ||
// 要是还是不行,返回一个随机值 | ||
@@ -264,3 +264,3 @@ | ||
var localeName = locale !== false && menuLocale !== false && formatMessage ? formatMessage({ | ||
var localeName = locale !== false && menuLocale !== false && formatMessage && locale ? formatMessage({ | ||
id: locale, | ||
@@ -267,0 +267,0 @@ defaultMessage: name |
@@ -29,3 +29,3 @@ "use strict"; | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
@@ -40,3 +40,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
@@ -115,4 +115,4 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
return "/".concat(_hash.default.sha256().update(JSON.stringify(item)).digest('hex')); | ||
} catch (error) {// dom some thing | ||
} // 要是还是不行,返回一个随机值 | ||
} catch (error) {} // dom some thing | ||
// 要是还是不行,返回一个随机值 | ||
@@ -285,3 +285,3 @@ | ||
var localeName = locale !== false && menuLocale !== false && formatMessage ? formatMessage({ | ||
var localeName = locale !== false && menuLocale !== false && formatMessage && locale ? formatMessage({ | ||
id: locale, | ||
@@ -288,0 +288,0 @@ defaultMessage: name |
{ | ||
"name": "@umijs/route-utils", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
318081
3741