MCPcopy Index your code
hub / github.com/callstack/agent-device / compareAppleDevicesForSelection

Function compareAppleDevicesForSelection

src/kernel/device.ts:338–348  ·  view source on GitHub ↗
(
  left: { device: TDevice; index: number },
  right: { device: TDevice; index: number },
)

Source from the content-addressed store, hash-verified

336}
337
338function compareAppleDevicesForSelection<TDevice extends DeviceInfo>(
339 left: { device: TDevice; index: number },
340 right: { device: TDevice; index: number },
341): number {
342 return (
343 appleDeviceSelectionRank(left.device) - appleDeviceSelectionRank(right.device) ||
344 Number(right.device.booted === true) - Number(left.device.booted === true) ||
345 left.device.name.localeCompare(right.device.name) ||
346 left.index - right.index
347 );
348}
349
350function appleDeviceSelectionRank(device: DeviceInfo): number {
351 if (device.kind === 'simulator') return appleTargetSelectionRank(device, 0, 1, 2, 3);

Callers 1

Calls 1

appleDeviceSelectionRankFunction · 0.85

Tested by

no test coverage detected