Skip to content

Commit

Permalink
Optimize slice last sharp tail (#7353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Connormiha authored and arcanis committed Jul 3, 2019
1 parent c31e4a9 commit 49332fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cli/commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export async function buildTree(
}

export function getParent(key: string, treesByKey: Object): Object {
const parentKey = key.split('#').slice(0, -1).join('#');
const parentKey = key.slice(0, key.lastIndexOf('#'));
return treesByKey[parentKey];
}

Expand Down
2 changes: 1 addition & 1 deletion src/hoisted-tree-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type HoistedTree = {
export type HoistedTrees = Array<HoistedTree>;

export function getParent(key: string, treesByKey: Object): Object {
const parentKey = key.split('#').slice(0, -1).join('#');
const parentKey = key.slice(0, key.lastIndexOf('#'));
return treesByKey[parentKey];
}

Expand Down

0 comments on commit 49332fa

Please sign in to comment.