(
candidates: readonly string[],
canResolve = (candidate: string): boolean => {
try {
require.resolve(candidate)
return true
} catch {
return false
}
}
)
| 58 | let nativeBinding: NativeBinding | null | undefined |
| 59 | |
| 60 | export function getInstalledNativePackageCandidates( |
| 61 | candidates: readonly string[], |
| 62 | canResolve = (candidate: string): boolean => { |
| 63 | try { |
| 64 | require.resolve(candidate) |
| 65 | return true |
| 66 | } catch { |
| 67 | return false |
| 68 | } |
| 69 | } |
| 70 | ): string[] { |
| 71 | return candidates.filter(canResolve) |
| 72 | } |
| 73 | |
| 74 | export function getNativePackageCandidates( |
| 75 | platform: NodeJS.Platform = process.platform, |
no outgoing calls
no test coverage detected