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

nilfalse / ctf / 5752977660

pending completion
5752977660

Pull #298

github

web-flow
Merge b6f7f6972 into da4e6f9f9
Pull Request #298: Update all of jest 27.5.1 → 29.6.2 (major)

0 of 266 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 613 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/packages/runtime/interceptors/ip.ts
1
import { Request } from '../lib/request';
2
import { db } from '../services/geo/geo_service';
3

4
import { Match } from './_common';
5

6
export interface IPMatch extends Match {
7
  heuristic: 'ip';
8
  extra: { registeredCountry: string } | null;
9
}
10

11
// eslint-disable-next-line @typescript-eslint/require-await
12
export async function dispatch({
13
  ip,
14
}: Request): Promise<ReadonlyArray<IPMatch>> {
15
  if (!ip) {
×
16
    return [];
×
17
  }
18

19
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
20
  const countryResponse = db!.get(ip);
×
21
  if (!countryResponse) {
×
22
    return [];
×
23
  }
24

25
  const result = [];
×
26
  const { country, registered_country: registeredCountry } = countryResponse;
×
27
  if (country) {
×
28
    const continent = countryResponse.continent
×
29
      ? countryResponse.continent.code
30
      : null;
31

32
    const extra = registeredCountry
×
33
      ? {
34
          registeredCountry: registeredCountry.iso_code,
35
        }
36
      : null;
37

38
    result.push({
×
39
      heuristic: 'ip' as const,
40

41
      score: 0.5,
42
      isoCountry: country.iso_code,
43
      isoRegion: null,
44
      continent,
45
      extra,
46
    });
47
  }
48

49
  return result;
×
50
}
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

© 2025 Coveralls, Inc