Skip to content

Commit

Permalink
fix: prevent undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 8, 2023
1 parent 310c2d1 commit acd575c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/fp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const sample = (arr: any[] = []) => {
return len ? arr[Math.floor(Math.random() * len)] : undefined;
};

export function find(subtitleList: any[], args: { [key: string]: any }) {
export function find(subtitleList: any[] = [], args: { [key: string]: any }) {
const key = Object.keys(args)[0];
return subtitleList.find((item) => item[key] === args[key]);
}

1 comment on commit acd575c

@vercel
Copy link

@vercel vercel bot commented on acd575c Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.