• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

inclusion-numerique / coop-mediation-numerique / 134f1cc8-b272-471e-be1c-25fe3b4baafa

17 Mar 2026 04:15PM UTC coverage: 6.94% (-3.9%) from 10.79%
134f1cc8-b272-471e-be1c-25fe3b4baafa

push

circleci

web-flow
Merge pull request #437 from inclusion-numerique/dev

release

470 of 10426 branches covered (4.51%)

Branch coverage included in aggregate %.

28 of 584 new or added lines in 86 files covered. (4.79%)

1348 existing lines in 161 files now uncovered.

1355 of 15871 relevant lines covered (8.54%)

37.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/web/src/utils/orderItemsByIndexedValues.ts
1
import { onlyDefinedAndNotNull } from './onlyDefinedAndNotNull'
2

UNCOV
3
export const orderItemsByIndexMap = <
×
4
  T extends { id: V },
5
  V extends string | number,
6
>(
7
  items: T[],
8
  indexMap: Map<V, number>,
9
): T[] => {
10
  // Sort the items using resultIndexById as their new index
UNCOV
11
  const sortedItems = Array.from<T>({
×
12
    length: indexMap.size,
13
  })
14

UNCOV
15
  for (const item of items) {
×
UNCOV
16
    const sortedIndex = indexMap.get(item.id)
×
UNCOV
17
    if (sortedIndex === undefined) {
×
18
      throw new Error(`Item with id ${item.id} not found in search results`)
×
19
    }
UNCOV
20
    sortedItems[sortedIndex] = item
×
21
  }
22

23
  // If the items size is not complete, some items will be undefined
UNCOV
24
  return sortedItems.filter(onlyDefinedAndNotNull)
×
25
}
26

UNCOV
27
export const orderItemsByIndexedValues = <
×
28
  T extends { id: V },
29
  V extends string | number,
30
>(
31
  items: T[],
32
  indexedValues: V[],
33
): T[] => {
UNCOV
34
  const indexMap = new Map<V, number>(
×
UNCOV
35
    indexedValues.map((id, index) => [id, index]),
×
36
  )
37

UNCOV
38
  return orderItemsByIndexMap(items, indexMap)
×
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc