MCPcopy Index your code
hub / github.com/formatjs/formatjs / getInstalledNativePackageCandidates

Function getInstalledNativePackageCandidates

packages/cli-lib/native.ts:60–72  ·  view source on GitHub ↗
(
  candidates: readonly string[],
  canResolve = (candidate: string): boolean => {
    try {
      require.resolve(candidate)
      return true
    } catch {
      return false
    }
  }
)

Source from the content-addressed store, hash-verified

58let nativeBinding: NativeBinding | null | undefined
59
60export 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
74export function getNativePackageCandidates(
75 platform: NodeJS.Platform = process.platform,

Callers 2

loadNativeFunction · 0.85
native.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected