(arr: T[], searchItem: T, searchIndex?: number)
| 102 | } |
| 103 | |
| 104 | export function includes<T>(arr: T[], searchItem: T, searchIndex?: number) { |
| 105 | if (typeof searchIndex === 'number' && arr[searchIndex] !== searchItem) { |
| 106 | return false; |
| 107 | } |
| 108 | for (const item of arr) { |
| 109 | if (item === searchItem) { |
| 110 | return true; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | return false; |
| 115 | } |
| 116 | |
| 117 | export function pick<T extends object, K extends keyof T>(obj: T, ...propNames: K[]) { |
| 118 | const resultMap = {} as Pick<T, K>; |
no outgoing calls
no test coverage detected