Skip to content

Commit

Permalink
feat: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed May 19, 2024
1 parent 79e7037 commit af28624
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions app/js/utils/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

interface Node<T> {
value: T;
prev: Node<T> | null;
next: Node<T> | null;
}

Expand All @@ -17,17 +16,15 @@ export class Queue<T> {

/**
* @method enqueue
* @description 入列
* @description 入列O
* @param value 要入列的值
*/
enqueue(value: T): void {
const self = this;
const { tail } = self;

const node: Node<T> = {
value,
next: null,
prev: tail
next: null
};

if (tail) {
Expand All @@ -50,14 +47,12 @@ export class Queue<T> {
if (head) {
const { next } = head;

if (next) {
next.prev = null;
} else {
self.head = next;

if (!next) {
self.tail = next;
}

self.head = next;

return head.value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/js/utils/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function parse<M = unknown>(
const { meta, children } = node;
const { key, name, icon, link } = meta;
const isLayout = children ? children.length > 0 : false;
const parentMenu = parent ? mapping.get(parent.meta.key) : null;
const parentMenu = parent ? mapping.get(parent.meta.key) : parent;

if (!name || guards.get(key) === Filter.REMOVE_SELF) {
if (isLayout && parentMenu) {
Expand Down

0 comments on commit af28624

Please sign in to comment.