Skip to content

Commit

Permalink
solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Izzet Yusufov authored and Izzet Yusufov committed Aug 1, 2023
1 parent 4a00861 commit db34404
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/goods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export function getAll(): Promise<Good[]> {
export const get5First = () => {
return getAll()
.then(goods => goods
.sort((a, b) => a.name.localeCompare(b.name)).slice(0, 5)); // sort and get the first 5
.sort((a, b) => a.name.localeCompare(b.name)).slice(0, 5));
};

export const getRedGoods = () => {
return getAll()
.then(goods => goods.filter(good => good.color === 'red')); // get only red
.then(goods => goods.filter(good => good.color === 'red'));
};

0 comments on commit db34404

Please sign in to comment.