-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: extractKeyFromArray, isMatchPath 유틸함수 추가 #10
- Loading branch information
1 parent
6fd08f2
commit d3826a6
Showing
3 changed files
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const extractKeyFromArray = <T, K extends keyof T>( | ||
array: Array<T>, | ||
key: K, | ||
): Array<T[K]> => array.map((item) => item[key]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { match } from "path-to-regexp"; | ||
|
||
export const isMatchPath = (pathname: string, urls: string[]) => | ||
urls.some((url) => !!match(url)(pathname)); |