MCPcopy Create free account
hub / github.com/decaporg/decap-cms / pickTarget

Function pickTarget

jest.resolver.js:11–29  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

9const CONDITIONS = ['require', 'import', 'default'];
10
11function pickTarget(target) {
12 if (typeof target === 'string') return target;
13 if (Array.isArray(target)) {
14 for (const item of target) {
15 const picked = pickTarget(item);
16 if (picked) return picked;
17 }
18 return null;
19 }
20 if (target && typeof target === 'object') {
21 for (const condition of CONDITIONS) {
22 if (condition in target) {
23 const picked = pickTarget(target[condition]);
24 if (picked) return picked;
25 }
26 }
27 }
28 return null;
29}
30
31/**
32 * Jest 27 ignores package.json `exports`, so it can't find subpath imports

Callers 1

resolveFromExportsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected