Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1x 1x 20x | export const extractIds = (filePaths: string[]): string[] => filePaths.map(path => path.split('/').pop() as string) export const getFieldIdsFromCollection = <T>(field: keyof T, collection?: T[]): string[] => { if (!collection?.length) return [] const dataIRIs = (collection as T[]).reduce<string[]>((acc, item) => { const value = item?.[field] if (Array.isArray(value)) { acc = [...acc, ...extractIds(value)] } else if (typeof value === 'string') { acc.push(...extractIds([value])) } return acc }, []) return dataIRIs } |