Skip to content

Commit

Permalink
feat: add takeRight (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
ze-flo authored Nov 17, 2023
1 parent dbdb078 commit 39b78c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ export const findLastIndex = (arr, func) => {

export const intersection = (arr, ...args) =>
arr.filter(item => args.every(arr => arr.includes(item)))


export const takeRight = (arr, qty = 1) => [...arr].splice(-qty, qty)

0 comments on commit 39b78c2

Please sign in to comment.